The Holy Grail of Excel Macros

Okay, so, you just got handed a job for a 100+ page workbook. Your client wants you to fix some formatting or something of the like on every page (the 100 pages already exist… creating that many is a different story…). What do you do? You use macros and let the computer do all the work, silly!😛 The best part is you can charge for all the hours it would have taken you to fix it all up without the snippet I’m about to give you! (Okay, this is probably a tad unethical…).

You’re interested? I thought so. We’re going to use the power of foreach loops to let the computer run through and do all this on every single page. The workflow I use looks something like this:

  1. On the first page (or a “test” page), I hit Record Macro and name it something I can remember. Be sure that you remember what the exact name of it is. This is very important. 
  2. Proceed to style/do whatever it is that you’re being paid to do. Ahem. 
  3. Once you’re done, stop recording the macro. At this point, I usually like to test the macro before I use it on my entire workbook, just to make sure it isn’t going to destroy it all.😛
  4. If you have verified the integrity, now we need to write a bit of code. :O But I have never used the Visual Basic editor! Don’t worry–it’s incredibly simple and you can basically copy and paste this snippet I’m about to give you and just change one little bit for all your repeating macros. 

Let’s get on to the code now, shall we?

Continue reading

Using a LeapMotion for Qt inputs

This is awesome!

Building Tepee3D

We are still working on our project Tepee3D and although we have not yet reached the popularity we hoped too, this project has allowed us to work on many interesting aspects, one of which is adding LeapMotion inputs to our application.
For those of you who don’t know what a LeapMotion is, it is a small sensor about the size of a lighter that you can use to track hands movement in space.
You can find more information about it on the LeapMotion web site.

There are several ways to interact with an application using the LeapMotion sensor. However as Tepee3D has mainly been focused on touch and multitouch inputs, one simple way to use the LeapMotion was to convert fingers 3D position in Qt touch points so that they could then be used in QTouchEvent or QMouseEvents without having to rewrite the entire application.

For the specific gestures (swipe…

View original post 1,753 more words

Adobe Island

I’m not a fan of cloud software either… I can live with files, but cloud software just doesn’t appeal to me. Of course, it’s already rumored that Windows 10 will be a cloud-based OS. Ugh.


So, I’ve written another story, after a long hiatus of not doing so. However, this story is different from my previous ones in a few ways.

  1. it was written over the course of a few days, rather than a few weeks
  2. I co-wrote it with JimbobJeffers
  3. It was on-the-spot writing, with little time to compose it all
  4. It wasn’t even a story to begin with!

I’ve titled this story

Adobe Island

because the original discussion started out about Adobe CS and the new subscription-based releases, and somehow turned into a LEGO Island almost-fanfic.

Hope you enjoy reading it as much as we did writing it!😀


View original post

Dark Fusion Theme for Qt 5

My favorite new theme (for Windows applications, at least) is the Fusion theme that came with Qt 5. I was working on an application recently where the people I was making it for wanted to be able to switch between a lighter and darker theme. Luckily, the Fusion theme uses the applications color palette. I’m putting the code up on Github in a gist, but there won’t be the code to switch between the two themes. I’ll post that later as a quick tip/tutorial.

You can find the theme on Github here. Alternatively, I’m posting the code below in a collapsed code box. Feel free to make changes and submit them back on Github though! You can use this theme in all your applications, but be sure to tell me about them if you can. I’d love to see what people do with it.🙂


QPalette darkPalette;
darkPalette.setColor(QPalette::Window, QColor(53,53,53));
darkPalette.setColor(QPalette::WindowText, Qt::white);
darkPalette.setColor(QPalette::Base, QColor(25,25,25));
darkPalette.setColor(QPalette::AlternateBase, QColor(53,53,53));
darkPalette.setColor(QPalette::ToolTipBase, Qt::white);
darkPalette.setColor(QPalette::ToolTipText, Qt::white);
darkPalette.setColor(QPalette::Text, Qt::white);
darkPalette.setColor(QPalette::Button, QColor(53,53,53));
darkPalette.setColor(QPalette::ButtonText, Qt::white);
darkPalette.setColor(QPalette::BrightText, Qt::red);
darkPalette.setColor(QPalette::Link, QColor(42, 130, 218));

darkPalette.setColor(QPalette::Highlight, QColor(42, 130, 218));
darkPalette.setColor(QPalette::HighlightedText, Qt::black);

qApp->setStyleSheet("QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }");

Quick Tip: Stay in Unity Play Mode while Coding

If you aren’t familiar with Unity, it’s a free game engine with a built-in game editor. I use Unity almost every day, and as you can imagine, I’m coding a lot. Now, when you are writing the majority of code for a game, you are testing things out. Perhaps you want to see how fast is fast enough, or how far is far enough. It can be a pain to enter and exit play mode constantly, but wait!

Unity has a nifty little feature that will recompile code and execute it, even while in play mode. You can easily switch over to Visual Studio (or MonoDevelop) and save your changes. Then you can “Alt + Tab” back over into Unity and quickly see your changes. The only downside to this is that, with large projects (10,000+ lines of C#), this can take a few seconds–even on a really fast machine. However, it’s invaluable when testing things, as you never have to leave your spot in play mode.😉

Happy coding!

Quick Tip: Load Fonts from a Local File with QML

If you are familiar with CSS, you have probably loaded an external font before. With an Internet application, you usually wouldn’t load it from a file, but for a desktop application that doesn’t require an Internet connection, loading from a file is a must. Luckily, this is extremely easy and the TTF file can be embedded right in the executable using the Qt resource system (QRC protocol). In QML, there is a provided FontLoader element that makes quick work of loading fonts. Here’s quick example:

FontLoader { id: myCustomFont; source: "qrc:/fonts/myCustomFont.ttf" }

Note that if you want to do so, it is possible to directly link to a URL on the Internet. However, I wouldn’t recommend this unless you can ensure that your user will have an Internet connection at run-time. Otherwise, I would recommend downloading the TTF file instead and putting it in a local resource file. Be sure to read the license before doing this though!

When you want to use the font later in a font field, for example, you can simply do:

And that’s it! You are all set to use custom Truetype Fonts in QML! I hope this helps you out with your QML application. Happy coding!