I need to be able to get a reference to a ribbon that is part of an add-in to invalidate / refresh buttons at times.
I have a module level public variable defined and instantiated when the workbook opens as such...
In the XLAM CustomUI declaration:
In a workbook module:
However sometimes (and i don't know why) the myribbon variable becomes Nothing after being used for a while. I don't really know why...
Instead of tracking down why the variable is being lost which is a valid question but i may not need to solve it, is there a way to access the ribbon object by name or any other object tree? So in the XLAM code modules i could do something like MyWorkbook.Ribbons("blah") or whatever to get the variable?
The ribbon still exists, it is clickable and the actions fire... I just don't have a global variable that i can call to refresh the buttons...
Thanks in advance.
I have a module level public variable defined and instantiated when the workbook opens as such...
In the XLAM CustomUI declaration:
VBA Code:
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="MyAddInInitialize" >
In a workbook module:
VBA Code:
Public MyRibbon As IRibbonUI
Sub MyAddInInitialize(Ribbon As IRibbonUI)
Set MyRibbon = Ribbon
End Sub
However sometimes (and i don't know why) the myribbon variable becomes Nothing after being used for a while. I don't really know why...
Instead of tracking down why the variable is being lost which is a valid question but i may not need to solve it, is there a way to access the ribbon object by name or any other object tree? So in the XLAM code modules i could do something like MyWorkbook.Ribbons("blah") or whatever to get the variable?
The ribbon still exists, it is clickable and the actions fire... I just don't have a global variable that i can call to refresh the buttons...
Thanks in advance.