Setting Ribbon Properties
The Ribbon extensibility model is a bit unusual. There is no opportunity to set the ‘label’ or ‘image’ property of the button after it is created, but there are
getImage callbacks that you can set up.
To get Excel to refresh your control (or the whole Ribbon extension) you need to set an onLoad callback (on the customUI element) which receives an
IRibbonUI interface for you to keep. This interface has two methods -
InvalidateControl - which you call when a control should be refreshed.
Excel-DNA can helps with the implementation of the getImage callback - call the
ExcelRibbon.LoadImage method (probably as
base.LoadImage(imageId) in your code) with the imageId of the picture you want to show - this way you can load the images you specify in the .dna file.
Articles on MSDN:
Making object wrappers to ease the scenario you have: Custom Task Panes, the Office Fluent Ribbon, and Reusing VBA Code in the 2007 Office System
Some Excel 2010 info:
- Customizing the backstage view in Excel 2010
- Customizing context menus in Excel 2010
- Tab activation and scaling in Excel 2010
- Andy Pope’s Ribbon Editor (new, additional support for office 2010)
- Ron de Bruin’s site with details of the Excel 2013 Backstage changes.
- Discussion about Excel-DNA ribbons and the QAT.
Also note that a ribbon designed in VSTO can be exported to xml, which gives a
<customUI ...> tag that can be used directly in Excel-DNA, though the ribbon handlers have to be re-implemented.