Thread: Shortcut
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_67_] Leith Ross[_67_] is offline
external usenet poster
 
Posts: 1
Default Shortcut


Hello Steph,

If by private module you mean a module you inserted into your VB
project then the answer is yes. However, you can only assign a ho
combination that isn't in use. This example calls the Sub (macro
"RunProgram" in such a module. The Sub must be Public for this to work
Place this code in ThisWorkbook under Excel Objects in your project i
the Private Sub WorkBook_Open() procedure.

EXAMPLE
'Assign Keys CTRL + ALT + R to RunProgram Macro
Application.OnKey Key:="%^r", Procedu="RunProgram"

Shift = "+", CTRL = "%", ALT = "^"

To learn more about Key Codes see SendKeys Method in the VB Help.


Sincerely,
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=47770