Click here to Skip to main content
15,882,504 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone,

is it possible to add and remove usercontrols in a powerpoint addin ribbon?
And if it is possible, how is it achieved?

THX in advance!

Olli
Posted

1 solution

Yes, both are possible.

The controls in the ribbon are declared in an XML file. I'm not aware of a method to traverse the XML and add/remove items directly.

In order to change the controls that you add to the ribbon, you simply maintain an XML file for each of the control configurations that you have.


As an example - A tute I followed for excel addins allowed you to toggle a check-box. If the box was checked then a drop-down control would function. If it wasn't then the box is disabled. This required two XML files.


It's been such a long time, I can't remember all of the ins and outs of what you can do from a macro-enabled spreadsheet, an xlsm addin or a (vb.net)COM dll addin.

Though I do seem to remember that you could do some things from a dll that you can't do from VBA. An example that springs to mind is customizing of a gallery control. I made an addin that showed if sheets had print-borders enabled or not - also allowing the easy toggling of the borders. I could dynamically draw a picture and add an item to the gallery control for each sheet in the book from a dll - I could not do the same from within VBA - the ribbon controls needed to be (pre) defined in an XML file.

'Custom UI Editor for Microsoft Office' was the tool I used to generate the XML.
 
Share this answer
 
Comments
hornet_79 17-Jul-12 4:46am    
Thx, put me in the right direction!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900