The Problem (Q-score 5, ranked #58th of 95 in the VBA Core archive)
The scenario as originally posted in 2010
I have created a pptm file with macros that open certain pptx templates. I then created a new tab with buttons for opening the files. I attached the macros I created to those buttons. All works great as long at my pptm file is open. But after I save it as a ppam file and install it as an add-in it no longer works. It seems the macros don’t come along and the buttons are still trying to reference the macros via the pptx name.
Does anyone know a simple way to create a custom tab to launch predefined templates? Or load macros by default like Word does? Or fix my situation above? The only alternative I see is an add-in that will only show up under the Add-In’s tab.
Why community consensus is tight on this one
Across 95 VBA Core entries in the archive, the accepted answer here holds niche answer (below median) status — meaning voters are unusually aligned on the right fix.
The Verified Solution — niche answer (below median) (+9)
4-line VBA Core pattern (copy-ready)
Are you manually creating the ribbon with the buttons? I use the Custom UI Editor Tool and it works like a charm.
-
Just create any macro in your .pptm, like this:
Sub SayHello(ByVal control As IRibbonControl) MsgBox "hello" End SubThe
(ByVal control As IRibbonControl)part is important. -
Then save and close your .pptm.
-
Open the Custom UI Editor Tool. From that tool, click Open from the File menu and navigate to your .pptm and open it.
-
On the Insert menu, click Office 2010 Custom UI Part. This will create a new XML document that will be inserted into your .pptm.
-
You can then use sample snippets to start creating your ribbon, but the simplest is just from the Insert | Sample XML menu, just click on Custom Tab. This will insert:
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"> <ribbon startFromScratch="false"> <tabs> <tab id="customTab" label="Custom Tab"> <group id="customGroup" label="Custom Group"> <button id="customButton" label="Custom Button" imageMso="HappyFace" size="large" onAction="Callback" /> </group> </tab> </tabs> </ribbon> </customUI>Where you see
Callbackin afteronAction, replace it with the name of your macro. In our example above, it isSayHello, so it should now look likeonAction="SayHello". -
Click Save and then close the Custom UI Editor Tool.
-
Open your .pptm in PowerPoint and test that a tab called Custom Tab has been created. Navigate to it and click on the happy face button. You should now get a message box.
-
Go to the Backstage by clicking on File and click Save As… and then choose as the file type PowerPoint Add-in (*.ppam) and save it in any location. Note the location.
-
Go to File | Options | Add-in and then select PowerPoint Add-ins from the Manage dropdown at the bottom of the dialog. Then click Go. Click *Add New… and add your add-in from the location you saved it.
-
Close PowerPoint and reopen it. The Custom Tab ribbon should be there. Click on the happy face icon to run your
SayHellomacro.
The only thing you’ll need to do beyond this is to customize your macros and ribbon controls they way you need them and for what you want them to do. Check out this link for more info: Customizing the 2007 Office Fluent Ribbon for Developers
Error-handling details to lift with the snippet
This answer wires error flow through MsgBox / Err.Description. Keep that intact: stripping it to “make it cleaner” removes the signal you’ll need when the macro fails silently on a user machine.
When to Use It — vintage (14+ years old, pre-2013)
Ranked #58th in its category — specialized fit
This pattern sits in the 93% tail relative to the top answer. Reach for it when your scenario closely matches the question title; otherwise browse the VBA Core archive for a higher-consensus alternative.
What changed between 2010 and 2026
The answer is 16 years old. The VBA Core object model has been stable across Office 2013, 2016, 2019, 2021, 365, and 2024/2026 LTSC, so the pattern still compiles. Changes that might affect you: 64-bit API declarations (use PtrSafe), blocked macros in downloaded files (Mark-of-the-Web), and the shift toward Office Scripts for web-first workflows.