For a VSTO workbook project, is there a best practice for getting a reference to a Ribbon object from the ThisWorkbook class?
Here's what I do: in the Ribbon class, I created a public method called InvalidateControl(string controlID). I need to call this method from the ThisWorkbook class, based on when a particular workbook-level event fires. But the only way to see a โlinkโ to this Ribbon object is to do this ...
Ribbon ribbon;
protected override IRibbonExtensibility CreateRibbonExtensibilityObject()
{
this.ribbon = new Ribbon();
return this.ribbon;
}
... which seems a little smelly. I mean, I have to redefine CreateRibbonExtensibilityObject()independently; everything that I do, except that the local link to the tape is supported, so I can call methods against it. But this is not so. Is there any other, better way to get this link in the ThisWorkbook class? Or is it pretty acceptable?
Thank!
source
share