Question

How can I assign a keyboard shortcut to a VBA macro in Outlook 2007?

I know how to create a tool for the macro and put it in a menu with an underscore shortcut. This solution requires me to use a shortcut of Alt + {menu key} + {tool key}. What if I want to assign it to Alt + F12 or something like that?

The Visual Basic Editor is assigned to the keyboard shortcut Alt + F11 in Outlook 2007. I want to assign a keyboard shortcut like that to a macro, or if necessary a macro on a tool in either a menu or a toolbar.

Was it helpful?

Solution

The article Do-It-Yourself IntelliSense from MSDN provides excellent information about key bindings in VBA.

OTHER TIPS

Since Outlook doesn't have the OnKey event, the easiest way is to assign a toolbar button to the macro and put an ampersand in its name somewhere. This only works if your shortcut letter doesn't conflict with an existing shortcut.

You may also have luck with setting a global hotkey, but it's usually more pain then it's worth:

http://www.mvps.org/vbvision/_samples/HotKey_Demo.zip

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top