3
votes

I have a VSTO Excel application with an own ribbon (defined in XML). The ribbon also consists of a toggle button. I want to change the state of the toggle button programmatically (from "Unpressed" to "Pressed"). It seemed that via Globals.ribbons it is not possible to access the button. Or is it not possible to access the content of a ribbon bar programmatically, except via callback methods?

1
Yeah, it seems like it is not possible. Here is a similar question: stackoverflow.com/questions/5780063/…Mitja Bezenšek

1 Answers

0
votes

You could change what "getPressed" callback returns and then call (Ribbon as IRibbonUI)?.InvalidateControl("myToggleButtonId");, where Ribbon is what is passed into OnRibbonLoad(object ribbon) callback. Then "getPressed" will be called again and the toggle button will be set accordingly to the return value.