Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a macro from PowerPoint add-in to ribbon

Tags:

powerpoint

It's possible to add macros from a macro-enabled PowerPoint (pptm) presentation from the ribbon by right clicking in the ribbon and selecting Choose commands from: Macros.

I want this to be available at any time, so I've saved the pptm file as an add-in (ppam) and loaded the add-in.

However, I find that it is not possible to add the macro from the add-in in the ribbon. How can this be done? Do I somehow need to register all available Subs from Auto_Open or similar with something like:

Sub MyCommand()
MsgBox "This worked"
End Sub

Sub Auto_Open()
' Magic code allowing me to add the above to the ribbon
End Sub

Thanks! Troels

like image 359
user1898148 Avatar asked Sep 14 '25 04:09

user1898148


1 Answers

You need to add special XML code to the PPTM file to make the ribbon mods you want and hook the button clicks to the VBA routines in the file. Google "Ribbon XML" (without quotes) for starters. There are a couple of decent free apps that help create/edit Ribbon XML.

The free Office RibbonX Editor by Fernando Andreu, available on GitHub is a good place to start: https://github.com/fernandreu/office-ribbonx-editor/ (or for the latest release: https://github.com/fernandreu/office-ribbonx-editor/releases/latest )

Ron DeBruin has a wealth of information about using RibbonX here: https://www.rondebruin.nl/win/s2/win001.htm

My bible on the subject has been RibbonX by Robert Martin, Ken Puls and Teresa Hennig (Wiley is the publisher). Available on Amazon.

like image 151
Steve Rindsberg Avatar answered Sep 16 '25 16:09

Steve Rindsberg