How to Insert and Customise MacroButton Fields in Microsoft Word

Creating interactive document templates—such as legal agreements, medical intake records, technical reports, and corporate proposals—often requires guiding end users to execute specific automated tasks or enter text at designated locations. While form control content blocks provide basic text input, Microsoft Word includes a versatile, legacy-compatible field code that bridges document prose with document automation: the MacroButton field code.

A MacroButton field embeds an interactive text element directly within normal paragraph flow. When configured, a single or double click on the button text can trigger a Visual Basic for Applications (VBA) macro, execute a built-in Microsoft Word command (such as launching the Print dialog or inserting a table), or serve as a self-erasing placeholder prompt that disappears the moment the user begins typing. Mastering MacroButton field codes streamlines document workflow automation across corporate Word templates.

Understanding MacroButton Field Code Syntax

The MacroButton field code adheres to a straightforward three-part structure:

{ MACROBUTTON MacroName DisplayText }

Component Breakdown

  • Field Delimiters ({ }): Special field brackets inserted via the Ctrl + F9 (Windows) or Cmd + F9 (macOS) keyboard shortcut. Manual curly braces typed from the keyboard are not recognized as field codes.
  • MacroName: The target action to execute upon clicking:
    • A custom VBA macro subroutine name located in the document or attached template (e.g., GenerateInvoiceReport).
    • A built-in Microsoft Word command name (e.g., FilePrint, InsertTable, ShowAllHeadings).
    • A dummy placeholder name (such as NoMacro or DoFieldClick) when using the field purely as a clickable text prompt.
  • DisplayText: The visible text, symbol, or button label displayed on the document page (e.g., [Click here to run report]).

Inserting a MacroButton Field Using Keyboard Shortcuts

The fastest and most reliable method to insert a MacroButton field in any Microsoft Word document is using native keyboard commands:

  1. Place your cursor at the exact paragraph location where the button or prompt should appear.
  2. Press Ctrl + F9 (Windows) or Cmd + F9 (macOS) to insert a pair of field brackets: { }.
  3. Inside the brackets, type the keyword MACROBUTTON, followed by the target macro name, and your display text:
    { MACROBUTTON UpdateClientRecords [Click to Update Records] }
  4. Press F9 (or right-click inside the field and select Toggle Field Codes or Update Field) to collapse the field code and display the rendered button text.

The document now displays the styled text [Click to Update Records].

Using MacroButton as a Self-Erasing Prompt Placeholder

One of the most practical applications of the MacroButton field in template design is creating self-erasing input prompts. When a user clicks on a MacroButton field, Word automatically selects the entire field. The moment the user types a single character, the placeholder text is instantly replaced by their typed text.

To create an input prompt that requires no VBA macro:

{ MACROBUTTON NoMacro [Click here and enter Client Name] }

Because NoMacro does not exist as a registered macro, clicking the text does not trigger code execution. Instead, it highlights the bracketed instructions, allowing the user to type their client name immediately without having to manually backspace or highlight the placeholder.

Executing Built-In Microsoft Word Commands

You can wire MacroButtons to built-in Microsoft Word commands to create intuitive one-click actions for non-technical users:

1. Quick Print Button

{ MACROBUTTON FilePrint [Click to Print Document] }

2. Insert Table Shortcut

{ MACROBUTTON TableInsertTable [Click to Add Data Table] }

3. Toggle Non-Printing Characters

{ MACROBUTTON ShowAll [Toggle Paragraph Marks] }

Connecting to Custom Visual Basic for Applications (VBA) Macros

To connect a MacroButton to custom automation logic:

  1. Press Alt + F11 to open the VBA Editor.
  2. In the Project Explorer, insert a new standard Module under your document project.
  3. Create a Public Subroutine with no arguments:
    Public Sub StampApprovalDate()
        Selection.TypeText Text:="Approved on " & Format(Now(), "YYYY-MM-DD HH:MM")
    End Sub
  4. Close the VBA Editor and save the document as a macro-enabled file (.docm or .dotm).
  5. Insert your MacroButton field referencing the exact macro name:
    { MACROBUTTON StampApprovalDate [Click to Approve Document] }
  6. Press F9 to compile. Double-clicking the button executes the VBA routine and inserts the formatted timestamp.

Formatting and Styling MacroButton Fields

MacroButtons can be styled using standard Word formatting tools. You can apply bold weights, change font colors, apply background highlighting, or enclose the text inside shaded table cells to create realistic visual buttons. Field styling persists across macro executions.

Configuring Single-Click vs Double-Click Execution

By default, Microsoft Word requires a double-click to trigger MacroButton fields within normal editing view to prevent accidental clicks while reading. To configure Word to trigger MacroButtons on a single click:

  1. Go to File > Options.
  2. Select Advanced from the left menu.
  3. Scroll to the Editing options section.
  4. Check the box for Enable click and type.

(In locked form templates or documents protected for forms, MacroButtons respond to a single click automatically).

Implementing MacroButton fields allows template designers to create intuitive, interactive Microsoft Word documents that bridge standard text formatting with powerful automated workflows.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.