How to Assign a Macro to a Button in a Word Document

word logo-newI know I have covered assigning a macro to a button on Quick Access Toolbar (QAT), but did you know that you could also add buttons in the text of your document??

These buttons have a macro or Word command assigned to them and you can control what happens when the button is clicked in your text. And this is all because you are using a field code!

We really should not refer to the macro as a “button,” because there is no graphic or icon involved. You can, however, create your own graphic and embed it into your field. That field code syntax would be:

MacroButton MacroName Display

MacroName is the name of the macro or command you would like to urn and Display is the text you would like displayed by the field code. If you use a graphic rather than text, then the graphic is displayed. When you double-click on the displayed text or graphic, then the macro or command defined by MacroName will be executed.

Follow the steps below to learn how to assign a command or macro to a button in your text:

  1. Position your cursor where you would like the MacroButton to appear.
  2. Click CTRL + F9 to insert a field.
  3. Between the field brackets, key in the field name MacroButton and a space).

word macro button

  1. Key in the name of the command or macro you want the button to executed.
  2. To find the correct macro or command names, you can right-click on a blank area of your Ribbon and click on Customize Quick Access Toolbar. You can the names in the dialog box.
  3. Key in the button name text you want displayed or inspect a graphic to be used.
  4. Click F9 to update the field display.

updated word field


About the Author

Carol Bratt

Carol holds A+, MCP, and MOS computer certifications and is the resident DCT Office expert. She trains the staffs of small law firms in the use of Microsoft Office applications and has authored many books covering Microsoft Office as well as written articles for Infopackets, TechnoLawyer, and Digital Harbor. For more Microsoft Office tips visit Carol's Corner Office or follow Carol on FaceBook and Twitter.

One Comment