Word.Tips.Net WordTips (Menu Interface)

Assigning a Macro to a Button in Your Text

Please Note: This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Assigning a Macro to a Button in Your Text.

You already know you can assign a macro to a button (a tool) on your toolbar. Word also allows you to add buttons within the text of you document. These buttons have a macro or a Word command assigned to them, and you can control what happens when the button is selected in text. This is all instituted through the use of a field code. It may be a bit of a misnomer to refer to the result of this field code as a "button," because no graphics are involved whatsoever, although you can create your own graphic and embed it into the field. The syntax for the field code is:

MacroButton MacroName Display

MacroName is the name of the macro or command you want to run, and Display is the text you want displayed by the field code. If you use a graphic instead of text, then the graphic is displayed. When a user double-clicks on the displayed text or graphic, then the macro or command defined by MacroName is executed.

To assign a command or macro to a button, and insert that button in your text, follow these steps:

  1. Position the insertion point where you want the button to appear.
  2. Press Ctrl+F9 to insert a field.
  3. Between the field brackets, type MacroButton, then the name of the command or macro you want the button to execute.
  4. Type the text you want displayed, or insert a graphic to be used as a button.
  5. Press F9 to update the field display.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (1571) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Assigning a Macro to a Button in Your Text.

Related Tips:

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!


Comments for this tip:

Alfred    04 Dec 2013, 06:06
I have the same problem as Jasmine: I press CTRL+F9, I type MacroButton and the name of the macro. Then, I insert a CommandButton form the Controls group. When I do this Development mode is automatically activated. I save my control and press ALT+F9 to update the field display. When I click to de-activate development mode, my buttons are doubled, and I can't get out of this.
Jasmine    26 Apr 2013, 14:59
Okay, so I was able to get it to work with a Command Button however, it keeps populating double the buttons. Why is this?
Jasmine    26 Apr 2013, 14:27
I have been trying to get this to work for about a week now and I was just able to get it to work with the TEXT. I am soooo happy!!! I would really like to use a button instead of using TEXT but if Shapes dont work, I cannot get a command button to work from the Active X control menu and a photo does not seem to work for me... what do you mean by "graphic" if it isnt one of the above?

awyatt    19 Dec 2011, 13:44

Since you are using Word 2010, you should click the link at the end of this tip to get to the version that works with Word 2010.
Pat    19 Dec 2011, 13:36
I am definitely having issues with this code in word 2010. I'm trying to ad a button that will allow for the "Send to Mail Recipient" macro to run. Should I add the name of the Macro of the actual codeing behind it. This is what I am typing {MacroButton Send to Mail Recipient Click Here to e-mail Form} What am I doing wrong because it will not work?


Leave your own comment:

  Notify me about new comments ONLY FOR THIS TIP
Notify me about new comments ANYWHERE ON THIS SITE
Hide my email address
*What is 4+5 (To prevent automated submissions and spam.)
          Commenting Terms

Our Company

Sharon Parq Associates, Inc.

About Tips.Net

Contact Us


Advertise with Us

Our Privacy Policy

Our Sites


Beauty and Style




DriveTips (Google Drive)

ExcelTips (Excel 97–2003)

ExcelTips (Excel 2007–2013)



Home Improvement

Money and Finances


Pests and Bugs

Pets and Animals

WindowsTips (Microsoft Windows)

WordTips (Word 97–2003)

WordTips (Word 2007–2013)

Our Products

Premium Newsletters

Helpful E-books

Newsletter Archives


Excel Products

Word Products

Our Authors

Author Index

Write for Tips.Net

Copyright © 2015 Sharon Parq Associates, Inc.