Background
When creating tools with PowerPoint VBA, placing buttons directly on slides can look unpolished. Adding a custom tab to the Ribbon (header area) provides a seamless, application-like experience.
This article summarizes how to use the Custom UI Editor Tool to add a custom tab and execute a UserForm.
1. Preparation of PowerPoint File
First, prepare the PowerPoint file (.pptm) and the VBA code.
Important: When calling a Sub from the Ribbon, the argument control As IRibbonControl is required.
VBA Code (Standard Module)
' The callback signature for the ribbon button must include (control As IRibbonControl)
Sub ShowUserForm(control As IRibbonControl)
UserForm1.Show
End Sub
2. Obtaining and Installing the Tool
Since the official installer often fails on modern systems, manual adjustments are required after downloading.
Download
Office Custom UI Editor [https://github.com/OfficeDev/office-custom-ui-editor]
- Click Code and select Download ZIP.
- Unzip the downloaded folder.
Installation (Workaround for Validation Error)
If setup.exe fails with “Application validation failed,” follow these steps to rename files by removing the .deploy extension.
Target Folder: publish\Application Files\CustomUIEditor_4_0_0_0
| Original File Name | New File Name |
CustomUIEditor.exe.config.deploy | CustomUIEditor.exe.config |
CustomUIEditor.exe.deploy | CustomUIEditor.exe |
CustomUIEditor.ico.deploy | CustomUIEditor.ico |
Target Folder: publish\Application Files\CustomUIEditor_4_0_0_0\Samples
| Original File Name | New File Name |
Custom OutSpace.xml.deploy | Custom OutSpace.xml |
Custom Tab.xml.deploy | Custom Tab.xml |
Excel - A Custom Tab.xml.deploy | Excel - A Custom Tab.xml |
Repurpose.xml.deploy | Repurpose.xml |
Word - Group on Insert Tab.xml.deploy | Word - Group on Insert Tab.xml |
Target Folder: publish\Application Files\CustomUIEditor_4_0_0_0\Schemas
| Original File Name | New File Name |
CustomUI.xsd.deploy | CustomUI.xsd |
CustomUI14.xsd.deploy | CustomUI14.xsd |
After renaming, run CustomUIEditor.exe directly from the folder.
3. Editing the Ribbon XML
- Launch CustomUIEditor.exe.
- Click Open and select your PowerPoint file (
.pptm). - Paste the following code into the editor window.
XML Code
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon>
<tabs>
<tab id="CustomTab" label="Code">
<group id="CustomGroup" label="Custom UserForm">
<button id="ShowUserFormButton" label="UserForm1" size="large" onAction="ShowUserForm" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
- Click Save.
Summary
When you open the PowerPoint file, a new tab named “Code” will appear in the Ribbon. Clicking the “UserForm1” button will execute the macro.
Key Points
- VBA: The Sub must accept
control As IRibbonControl. - XML: The
onActionattribute must match the VBA Sub name exactly. - Tool: Removing
.deployextensions allows the tool to run without installation.
