Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Having found that I can't bind custom keyboard shortcuts to macros I've written for Outlook 2010, I turned to AutoHotKey and have a working solution, but it's clumsy. Here is one script and I have two more that execute different macros.

#IfWinActive, Inbox
WinWaitActive, ahk_class #32770, Macros, 0
Send, ActionSelectedMessages{ALTDOWN}r{ALTUP}

It sends Alt-F8 to open the Macros dialog, waits for the window to open, then sends the name of the macro followed by Alt-R to run it. This works but is slow and ugly with the dialog opening and closing.

So my question is whether there is any way to execute an Outlook macro from AutoHotKey that will not cause any interface side-effects as this solution does?

share|improve this question
up vote 5 down vote accepted

It turns out that this is rather easy to do. I had already added my three macros to the home strip in the Outlook ribbon and discovered that you can't bind shortcut keys as you could when adding items to the old toolbar. But what I didn't notice, is that shortcuts are automatically assigned to the new ribbon items, as seen in the screenshot.

alt text

Knowing that, it's possible to invoke these functions with three keystrokes; Alt-H, followed by Y1, Y2 or Y3. Taking this a step further I modified my AutoHotKey script to send these keystrokes and have now reduced these to the single keystrokes Alt-1, Alt-2 and Alt-3. Here is the script.

#IfWinActive, ahk_class rctrl_renwnd32


share|improve this answer
Indeed, people that used shortcuts before might hate the ribbon till they learn about the ALT key one or another day... You seem to have found it! Hmm, you seem to be implementing GTD macros, can't you use the new Quick Actions feature from Outlook 2010 to get the same behaviour? It's the white box at the top containing a few quick actions which you could adjust. Although this looks nice too (big icons) and probably has more freedom. How did you assign the icon, does Outlook provide those as an option? – Tom Wijsman Jun 28 '10 at 9:59
It seems the quick steps can do just what I want, including marking read/unread depending where the message is being moved. I will use them instead of the VBA macros. – Steve Crane Jun 28 '10 at 15:39
When you add items to the ribbon there is a limited set of icons you can choose from, same ones as for the older toolbar I think. Most seem to be 16×16 and have jaggies at this size. Took some trial and error to find suitable ones that looked good. – Steve Crane Jun 28 '10 at 15:40
You have no idea how happy this makes me. And @TomWijsman as someone who DOES know about the alt ribbon, it makes me unbelievably annoyed because it 100% removed the ability to specify your own keyboard shortcuts in Outlook. – enderland Feb 28 '13 at 22:24

I was able to accomplish something similar by adding it to the Quick Access Toolbar. Right click on whatever button you want a hotkey on, set it to Quick Access Toolbar, and it automatically gets an ALT + # combination.

share|improve this answer

Have you written a Visual Basic for Applications (VBA) macro that you'd like to run without going through the Macros dialog box? With the Customize dialog box open, under Categories, select Macros and drag your macro to a toolbar. Macro names tend to be long and ugly, so right-click the macro button and change the macro's name. Add an ampersand to set a hot key if you use the macro frequently.


Maybe you can accomplish this in the same way in Outlook 2010?

If not, you will need to write an add-on instead of a macro... But that would be a StackOverflow question.

share|improve this answer
While you can add macros to the ribbon in this way, which I have already done, you can't bind hotkeys to ribbon items as you could with pre-2007 toolbars. – Steve Crane Jun 28 '10 at 9:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .