Given that I have stored the IRibbonUI object onLoad, can I use that to modify the CustomUI.xml in my stub .xlam ribbon? If not, can it be used to add tabs, controls, etc. via VBA code?
2 Answers
The IRibbonUI object can only invalidate, i.e. reset the caches, on already defined controls and switch tabs on the ribbon. However, you can use the invalidation to trigger callbacks which show/hide already-defined controls by using the getVisible property, for example see this answer: Hide individual custom ribbon buttons. Or change their images as per: Excel Ribbon Dropdown background color.
The Ribbon XML is immutable for the life of the related COM add-in. If you want to specify a completely new Ribbon XML, you need another master/controller addin to disconnect and re-connect the COM addin which declared the Ribbon. This is a bit more complicated, so hopefully you can achieve what you need with the getVisible functionality.

- 336
- 2
- 7
-
Thank you for the confirmation. I will look for other methods to accomplish my requirements. – Crew Reynolds Sep 27 '20 at 16:41
Thank you for that confirmation. I saw that this can be done in MS Project but, sadly, not in Excel.
All of the other items you mentioned regarding callbacks are in place and working well. Hide/show, changing labels, etc. but always on pre-defined controls.

- 27
- 6