Skip to main content

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

Author: Xiaoyang Last Modified: 2018-11-14

Sometimes, you may want to apply a button to run a specific macro code in a Word document, but, how could you solve this task in Word file?

Apply a button to run a specific macro code in Word document


Apply a button to run a specific macro code in Word document

The following steps can help you to deal with this job in Word document, please do as this:

1. Click where you want to use a button, and then press Ctrl +F9 key to insert a pair of braces, and then type the below text between the braces, see screenshot:

MACROBUTTON MacroName Double-Click To Run Macro

doc button to run code 1

Note: MacroName is the code name in your Word file that you want to run when clicking the button, please change it to your need.

2. Then, right click the field code, and select Toggle Field Codes from the context menu, see screenshot:

doc button to run code 2

3. And then, you can format the field text with border and shading for making it as a button. Please select the field text, and then choose Borders and Shading from the Borders drop down list under the Home tab, see screenshot:

doc button to run code 3

4. In the Borders and Shading dialog box, specify the border style and shading color as you need. See screenshot:

doc button to run code 4

5. Then, click OK, and the field text has been formatted as a button, now when double clicking this button, your specific macro code will be triggered at once, see screenshot:

doc button to run code 5

Best Office Productivity Tools

Kutools for Word - Elevate Your Word Experience with Over 100 Remarkable Features!

🤖 Kutools AI Assistant: Transform your writing with AI - Generate Content  /  Rewrite Text  /  Summarize Documents  /  Get Quick Answers, all within Word

📘 Document Mastery: Split Pages  /  Merge Documents  /  Export Selection in Various Formats (PDF/TXT/DOC/HTML...)  /  Batch Convert to PDF  /  Export Pages as Images  /  Print Multiple Files at once...

Contents Editing: Batch Find and Replace across Multiple Files  /  Resize All Pictures  /  Transpose Table Rows and Columns  /  Convert Table to Text...

🧹 Effortless Clean: Sweap away Extra Spaces  /  Section Breaks  /  All Headers  /  Text Boxes  /  Hyperlinks  /  For more removing tools, head to the Remove group...

Creative Inserts: Insert Thousand Separators  /  Check Boxes  /  Radio Buttons  /  QR Code  /  Barcode  /  Diagonal Line Table  /  Equation Caption  /  Image Caption  /  Table Caption  /  Multiple Pictures  /  Discover more in the Insert group...

🔍 Precision Selections: Pinpoint Specific Pages  /  Tables  /  Shapes  /  Heading Paragraphs  /  Enhance navigation with more Select features...

Star Enhancements: Navigate to Any Location  /  Auto-Insert Repetitive Text  /  Toggle Between Document Windows  /  11 Conversion Tools...

👉 Want to try these features? Download Kutools for Word today and experience the difference! 🚀
Free Download     Read More     Buy Now
 
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations