Skip to main content

Kutools for Office โ€” One Suite. Five Tools. Get More Done.

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

Author Xiaoyang Last modified

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 copy the below text between the braces: MACROBUTTON MacroName Double-Click To Run Macro.

Braces with text copied

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

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

Toggle Field Codes option on the context menu

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:

Borders and Shading option on the Borders drop down

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

Borders and Shading dialog box

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:

Field text now looks like a button

Best Office Productivity Tools

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

๐Ÿค– Kutools AI Features: AI Assistant / Real-Time Assistant / Super Polish (Preserve Format) / Super Translate (Preserve Format) / AI Redaction / AI Proofread...

๐Ÿ“˜ Document Mastery: Split Pages / Merge Documents / Export Selection in Various Formats (PDF/TXT/DOC/HTML...) / Batch Convert to PDF...

โœ 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 / Text Boxes / Hyperlinks / For more removing tools, head to the Remove group...

โž• Creative Inserts: Insert Thousand Separators / Check Boxes / Radio Buttons / QR Code / Barcode / 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...

๐ŸŒ Supports 40+ Languages: Use Kutools in your preferred language โ€“ supports English, Spanish, German, French, Chinese, and 40+ others!

Kutools and Kutools Plus tabs on the Word Ribbon
๐Ÿ‘‰ Want to try these features? Download Kutools for Word now! ๐Ÿš€
 

โœจ Kutools for Office โ€“ One Installation, Five Powerful Tools!

Includes Office Tab Pro ยท Kutools for Excel ยท Kutools for Outlook ยท Kutools for Word ยท Kutools for PowerPoint

๐Ÿ“ฆ Get all 5 tools in one suite | ๐Ÿ”— Seamless integration with Microsoft Office | โšก Save time and boost productivity instantly

Best Office Productivity Tools

Kutools for Word - 100+ Tools for Word