How do I bind a macro to a key in Word 2007 without recording a new macro?
-
13-09-2019 - |
Question
As the title so eloquently put it, I need to know how (or if it's even possible) to bind a macro to a key in Microsoft Word 2007 without recording a new macro each time.
I find myself writing new macros directly in code and then not being able to bind them to a key. Or I might just want to rebind a macro to another key.
OTHER TIPS
As suggested, look up Word's KeyBindings
object in the help file.
Additionally, if your macro must work with international keyboards, this is a very good read:
- Do-It-Yourself IntelliSense (The KeyBindings Mess section)
Here is an answer from Microsoft: http://office.microsoft.com/video.aspx?assetid=ES010336334&vwidth=884&vheight=540&CTT=11&Origin=
Essentially,
- Click the Office Button.
- Select Word Options (near the bottom next to Exit Word).
- Select Customize. 4a. If you want to add the macro to a button, select "Macros" from the dropdown under "Choose commands from:". 4b. If you want to add a keybind, click Customize (at the bottom towards the left, next to "Keyboard shortcuts:". Here is the same window as when you create a new macro. Just be sure to click "Assign" after picking the keystroke.
The best solution I've come up with has been to record a new empty macro to the key I want (say, Ctrl+Num . [the Del key on the numpad]) and name the macro ctrl_num_dot. Then I can call any macro from the ctrl_num_dot subroutine.