Command Bar Extensions for the Ribbon

With the design of RibbonX based around XML and callbacks instead of an object model, it is the responsibility of the customizing application to maintain the state information for all its controls. That raises the question of how to query that state information—without an object, you have nothing to read the properties from! Fortunately, the CommandBars object has been extended with GetEnabledMso, GetImageMso, GetLabelMso, GetPressedMso, GetScreenTipMso, GetSuperTipMso, and GetVisibleMso properties to expose all the state information for the built-in controls. In each case, you pass in the name of the built-in control. These functions are likely to be most useful to add-in writers who want to include control images on their UserForms or ensure that they're using the correct control labels when directing users to click a Ribbon control. Note that you don't have a GetTextMso to return the text of a dropDown, comboBox, or editBox, nor can you call these functions with the ID of a custom control to query other add-ins' customizations.

As well as being able to retrieve the state information, you can also click any built-in control using the new ComandBars.ExecuteMso method. This is extremely useful for triggering those actions that don't have an object model equivalent — such as putting the user in drawing mode to draw a text box on a sheet:

Application.CommandBars.ExecuteMso "TextBoxInsertExcel"

0 -1

Post a comment