How to apply a button to run a macro code in a Word document ?

Sometimes, you may want to apply a button to run a specific macro code within a Word document. However, how can you accomplish this task in a Word file?

Applying a Button to Run a Specific Macro Code in a Word Document

The following steps can help you achieve this task within a Word document. Please follow these instructions:

  1. Click where you want to place the button, then press Ctrl + F9 to insert a pair of curly braces. Enter the text below inside the curly braces, as shown in the screenshot:
    MACROBUTTON MacroName Double-click to run Macro

    Note: Replace “MacroName” with the name of the macro in your Word file that you want to run when the button is clicked. Please customize it accordingly.

  2. Right-click on the field code and select “Toggle Field Codes” from the context menu, as shown in the screenshot:

    How to apply a button to run a macro code in a Word document

    How to apply a button to run a macro code in a Word document

  3. You can then format the field text with border and shading to turn it into a button. Select the field text, then choose “Borders and Shading” from the Home tab, as shown in the screenshot:
  4. In the Borders and Shading dialog, specify the border style and shadow color according to your preference, as shown in the screenshot:
  5. Click OK, and the field text is now formatted as a button. Now, when you double-click on this button, your specific macro code will be activated immediately, as shown in the screenshot:

We will be happy to hear your thoughts

Leave a reply

Gotkey.net
Logo
Compare items
  • Total (0)
Compare
0
Shopping cart