Assigning a Keyboard Shortcut to a Macro in VS
- 15 Dec 2005 21:33
Last time I forgot to mention one important thing - how to assign a keyboard shortcut to your macro. Often you don't need any button for your macro, the shortcut is enough. Or you can have both. As I already wrote, macro is similar to any named command. So to assign a shortcut to it:
Go to menu Tools - Options... and select Environment - Keyboard.
Find your macro in the list of commands. All macro names start with "Macro.". To filter out other commands enter your macro name in the Show commands containing field. If your macro is named test as in our example then type
test. Select your macro.
- Go to Press shortcut key(s) field and press your shortcut. If the shortcut is already in use, you will see it. Press Assign button. Remember that you cannot change or assign the shortcut if you are using predefined keyboard mapping scheme. You will be warned in this case. You must create a copy of current scheme and use that copy. Press Save As... button under Keyboard mapping scheme and give it some name. Then select this new scheme.