#1
|
|||
|
|||
Assigning shortcut keys via a macro file
How do I assign a shortcut key to a MS Word subroutine?
I already know how to do it via the "Customize Ribbon" Options menu, but I'm interested in hardcoding the keys inside a macro file. I understand I need to use something like the code below, but where exactly do I insert this code? I tried adding it to the 'ThisDocument' section, without any success. Code:
With Application .CustomizationContext = ThisDocument .KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyF1), _ KeyCategory:=wdKeyCategoryCommand, _ Command:="printAllRecords" End With As an example, what I need is to call "MyScript1" subroutine when pressing Ctrl + L, and "MyScript2" subroutine when pressing Alt + L. Alex |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
macro used to activate shortcut keys | hudsontucker13 | PowerPoint | 1 | 12-14-2013 09:47 AM |
Word VBA: assign shortcut keys to sub??? | tinfanide | Word VBA | 2 | 12-05-2011 03:41 AM |
Outlook Mail Shortcut Keys? | gratiot | Outlook | 3 | 07-29-2011 10:31 AM |
cant use shortcut keys (ctrl+c/v/z...) | laro | Office | 0 | 10-08-2010 11:01 PM |
Can't Assign Shortcut Keys | Vicki F. | Word | 0 | 04-17-2010 03:03 PM |