The way that I do it is to have a control of type dynamicMenu in the XLM. This control invokes a callback that I call rxGetContent. This callback returns XML that defines the menu that will be displayed. This is my code for rxGetContent, which in turn calls a function to build the XML. This function is passed an id, to differentiate this app, a matrix that holds all of the properties of the menu items, and an image to show alongside the menu items.
Note that CONTROLID_RB_DYNA_MENU is a public constant where I store the dynamic menu control name that I assign in the XML.
The matrix has as many rows as you have items, and 4 columns, the item name (which is appended to the function id parameter, the item label, the macro that is called if the item is clicked, and a tag property for the item which allows a parameter value if required. This matrix needs to be setup as the workbook opens, and would be of the form
Finally, this is the code that builds the XML
NAMESPACE_RIBBON_2007 is another public constant with the value
Bookmarks