If you place a breakpoint in one of the VBA callbacks (GetImage, GelLabel, GetEnabled, etc.) then activate a different workbook when the code breaks, you can duplicate the behavior. Finally, the error will appear when you execute the code again (for example, by pressing F5).
Using the ribbon. Invalidate method, you may make the ribbon refresh automatically (if you previously saved the ribbon object). The ribbon object can be saved by specifying a onLoad callback:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="InitRibbon">
with this in VBA:
Private moduleLevelRibbonObject As IRibbonUI
Public Sub InitRibbon(ribbon As IRibbonUI)
Set moduleLevelRibbonObject = ribbon
Calling moduleLevelRibbonObject.Invalidate will refresh the ribbon (if the state was not lost - but that is a different topic).
A quick fix that I've found. Just add something like this:
If Not ThisWorkbook Is ActiveWorkbook Then ThisWorkbook.Activate
I hope this helps you.