Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Shortcut
Is it possible to assign a shortcut keystroke (ie Ctl U) to a sub procedure
if it resides in a private module? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Shortcut
You can not assign a hot key to a private anything. If at the top of your
module you have... option private module then everything in the module is hidden adn the scope of everything in the module is private. If you have Private Sub Test then the scope of this procedure is private and once again you will not be able to refernece it outside of the module. By default whether explicitly stated or not everything else is Public. If however your procedure takes arguments then you will not be able to assign a hot key. Public Sub Test This is public and you can assign a hot key to it. Tools - Macros - Macros - Options... -- HTH... Jim Thomlinson "Steph" wrote: Is it possible to assign a shortcut keystroke (ie Ctl U) to a sub procedure if it resides in a private module? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
shortcut has change or move so this shortcut can not open | Excel Worksheet Functions | |||
Shortcut key?? | Excel Discussion (Misc queries) | |||
Add-In Shortcut key | Excel Programming | |||
Shortcut Key | Excel Programming | |||
Shortcut key | Excel Programming |