Magnus Lindhe
Magnus Lindhe

Reputation: 7317

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

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.

Upvotes: 6

Views: 19370

Answers (2)

guillermooo
guillermooo

Reputation: 8115

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

Upvotes: 3

rpetrich
rpetrich

Reputation: 32316

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

Upvotes: 8

Related Questions