'How can a PowerPoint 365 add-in (.ppam) add a button for a macro to the Quick Access Toolbar?
I have "Microsoft 365 Apps for enterprise". I have developed a VBA Word macro and a VBA PowerPoint macro.
I want a similar user interface for each macro: ideally, a Quick Access Toolbar button.
For Word, this is easy:
- In the macro-enabled template (
.dotm), use the Word UI (File > Options > Quick Access Toolbar) to add a button for the macro, for just the.dotmfile. - Copy the
.dotmfile to the%APPDATA%\Microsoft\Word\STARTUPdirectory. - Restart Word.
The button appears in the Word Quick Access Toolbar for all documents, and works. Job done.
For PowerPoint, not so easy, hence this question. The equivalent steps for PowerPoint don't work:
- In the macro-enabled template (
.potm), use the PowerPoint UI (File > Options > Quick Access Toolbar) to add a button for the macro, for just the.potmfile. - Save the
.potmfile as a.ppam(PowerPoint add-in). - Exit PowerPoint.
- Copy the
.ppamto the%APPDATA%\Microsoft\AddInsdirectory - Start PowerPoint.
- Load that add-in (File > Options > Add-ins > Manage: PowerPoint Add-ins > Go > Add New > select the
.ppam> Open)
The Quick Access Toolbar button appears, but clicking it results in the error message:
The macro cannot be found or has been disabled because of your security settings
Solution 1:[1]
Diagnosis:
The macro cannot be found because the Quick Access Toolbar action in the .ppam refers to the .potm file name, not the .ppam.
Solution:
- Unzip the
.ppamfile - Open the
userCustomization\customUI.xmlfile in a text (or XML) editor - Change the file extension for the corresponding
onActionattribute value (that runs the macro) from.potmto.ppam - Rezip the tweaked
.ppam - Unload and remove the old "untweaked" add-in from the PowerPoint Option > Add-ins...
- Exit PowerPoint
- Copy the tweaked
.ppamover the old file in%APPDATA%\Microsoft\AddIns - Start PowerPoint
- Load the newly tweaked add-in (File > Options > Add-ins > Manage: PowerPoint Add-ins > Go > Add New > select the
.ppam> Open)
The Quick Access Toolbar button should now run the macro.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Graham Hannington |
