Field codes: MacroButton field

The MacroButton field Inserts a macro command, which you can run by double-clicking the results of a MACROBUTTON field. You can also click in the MACROBUTTON field and then press ALT+SHIFT+F9.

Security Note: Because macros can contain viruses, be careful about running them. Take the following precautions: run up-to-date antivirus software on your computer; set your macro security level to high; clear the Trust all installed add-ins and templates check box; use digital signatures; maintain a list of trusted publishers.


When you view the MacroButton field in your document, the syntax looks like this:

{ MACROBUTTON MacroName DisplayText }

Note:  A field code tells the field what to show. Field results are what’s shown in the document after having evaluated the field code. To toggle between viewing the field code and the field code results, press Alt+F9.



The name of the macro to run when you double-click the field result. The macro must be available in the active documenttemplate or a global template.


The text or graphic to appear as the "button." You can use a field that results in text or a graphic, such as BOOKMARK or INCLUDEPICTURE. The text or graphic must appear on one line in the field result; otherwise, an error occurs.


Double-clicking the following field runs the PrintEnvelope macro.


Double-click { MACROBUTTON PrintEnvelope Button image } to print an envelope for this letter.


Double-click Button image to print an envelope for this letter.

Expand your Office skills
Explore training
Get new features first
Join Office Insiders

Was this information helpful?

Thank you for your feedback!

Thank you for your feedback! It sounds like it might be helpful to connect you to one of our Office support agents.