Assigning keyboard shortcut to VBA macro programmatically
-
Monday, June 11, 2007 8:29 PMUsing OLE, I create an Excel sheet with graphs and some macros to manipulate them. I'd like to assign keyboard shotcuts to the macros, so that the user has easy access to them. I can't figure out - however - how to do that. Any suggestions? Thanks in advance.
All Replies
-
Tuesday, June 12, 2007 7:24 AM
Hi
Using the macro recorder in Excel often gives an answer. I assigned Ctr+Shift+F to macro1 and recorded this as a macro. results are below:
Application.MacroOptions Macro:="Macro1", Description:= _
"Macro recorded 12/06/2007 by Tony Green", ShortcutKey:="F" -
Tuesday, June 12, 2007 11:00 AM
You can use Application.Onkey to set the key for the macro
Here you have the sample code and commonly used keys : http://vbadud.blogspot.com/2007/06/assigning-shortcut-keys-excel-macros.html
Cheers
Shasur
-
Tuesday, June 12, 2007 8:56 PMThanks, that works!

