Create a Template-Specific Ribbon in Word 365
Question details
The user needs to make a custom ribbon tab appear only when a specific Word 365 template is open.
- Product
- Microsoft Word 365
- Device & OS
- not provided
- Scenario
- A Word template contains macros or custom commands, and the user wants those commands exposed in a ribbon tied to the template instead of the global Word interface.
- Observed behavior
- Currently, ribbon customization affects the Word application rather than the selected template, so no template-specific ribbon appears when only that template is open.
Before editing the template package, make sure the template is saved as a macro-enabled Word template (.dotm), back up the file, and enable the Developer tab in Word 365 so you can access VBA macros.
Add custom UI XML and VBA callbacks to the .dotm template
Use this method when you need a full ribbon tab that only appears while a specific macro-enabled template is open.
A .dotm file is an Office Open XML package. You can embed a customUI/customUI.xml part that declares a template-specific ribbon tab and connects each control to a VBA callback macro stored in the same template. This approach keeps the ribbon out of the Word application and avoids changing other documents.
In Word 365, open or create the template as a .dotm file, press Alt+F11 to open the VBA editor, and insert Sub procedures such as Public Sub MyButton_onAction(control As IRibbonControl). Save the template.
Close Word, copy the .dotm file, then open the copy in a ZIP tool or rename the extension to .zip so you can access the internal [Content_Types].xml and _rels folders.
Create a folder named customUI, add a file named customUI.xml, and insert Ribbon XML with a tab element whose onAction attributes reference the VBA callbacks.
Open _rels/.rels and add a Relationship with Type http://schemas.microsoft.com/office/2006/relationships/ui/extensibility and Target customUI/customUI.xml. Save and close the package.
Rename the package back to .dotm if needed, open the template in Word 365, and confirm the new tab appears only when that template is active.
Use the Quick Access Toolbar for a simpler template-specific control set
Use this alternative when you only need a few template-specific buttons and want to avoid Ribbon XML editing.
Use WPS Office as a Free, Lighter Way to Work with Word Templates
If editing Word 365 Ribbon XML feels too technical, WPS Office is a free, lightweight alternative that opens Word .dotm and .docm files, keeps the familiar ribbon-style workspace, and handles template and macro-based documents for everyday editing.
- 1. Download WPS Office: Go to the official WPS Office download page and download the free Windows, macOS, or mobile installer.
- 2. Install and launch WPS Office: Run the installer, open WPS Office, and sign in or skip to start using the office suite.
- 3. Open your Word template: Click Open, choose the .dotm or .docm template file, and let WPS Office open it in its Word-compatible writer.

Frequently Asked Questions
Can I create a template-specific ribbon without editing XML?
Word does not expose a simple click-through option for a template-specific ribbon tab. The supported method is to edit the template package's customUI XML and add VBA callbacks. A non-ribbon alternative is to store Quick Access Toolbar buttons in the template.
Why does my custom ribbon appear in all documents instead of only the template?
If you added the ribbon through Word Options or an add-in, it is likely stored at the application level. Move the custom UI XML into the .dotm package so Word loads it only when that template is active.
What file format should the template use?
Use a macro-enabled template with the .dotm extension. A .dotx file cannot store the VBA callbacks required by the ribbon controls.
Does WPS Office support the same Word 365 Ribbon XML?
WPS Office is not a drop-in editor for Word's customUI XML. However, it opens .dotm and .docm files and provides a ribbon-style interface for template and document work, making it a practical free alternative for many users.




