AndroidDev
AndroidDev

Reputation: 691

Assigining Keyboard Shortcut to Add-in

I have created an add-in that is a Userform.

How can I do to assign a keyboard shortcut (to show the form) so I can use it when I load it in any Workbook ?

Thanks!

Upvotes: 2

Views: 3494

Answers (1)

Dick Kusleika
Dick Kusleika

Reputation: 33145

The Application.OnKey method works at the application level, not just the workbook or worksheet level. If you set OnKey, that code will run wherever you are.

I use Sub Auto_Open() to set the hotkeys when my addins load. This is the old style (the new style being an AddIn_Load event.

Make sure you set remove the shortcut in Sub Auto_Close() or a similar event procedure.

Upvotes: 2

Related Questions