Search code examples
vbams-wordkey-bindings

How do I bind a macro to a key in Word 2007 without recording a new macro?


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.


Solution

  • Look at the KeysBoundTo collection - see here, the BuildKeyCode method - see here and the list of wdKey constants here