Graham Hannington
Graham Hannington

Reputation: 1987

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:

  1. 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 .dotm file.
  2. Copy the .dotm file to the %APPDATA%\Microsoft\Word\STARTUP directory.
  3. 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:

  1. 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 .potm file.
  2. Save the .potm file as a .ppam (PowerPoint add-in).
  3. Exit PowerPoint.
  4. Copy the .ppam to the %APPDATA%\Microsoft\AddIns directory
  5. Start PowerPoint.
  6. 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

Upvotes: 2

Views: 1320

Answers (1)

Graham Hannington
Graham Hannington

Reputation: 1987

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:

  1. Unzip the .ppam file
  2. Open the userCustomization\customUI.xml file in a text (or XML) editor
  3. Change the file extension for the corresponding onAction attribute value (that runs the macro) from .potm to .ppam
  4. Rezip the tweaked .ppam
  5. Unload and remove the old "untweaked" add-in from the PowerPoint Option > Add-ins...
  6. Exit PowerPoint
  7. Copy the tweaked .ppam over the old file in %APPDATA%\Microsoft\AddIns
  8. Start PowerPoint
  9. 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.

Upvotes: 2

Related Questions