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 getLabel and 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 - Invalidate and 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:

Some Excel 2010 info:

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.