Microsoft Office Tutorials and References
In Depth Information
12.4 Command-Bar Controls
12.4 Command-Bar Controls
Initially, one of the most confusing aspects of the Office menu system is that the items that appear
on a menu bar are not menus, or even names of menus. Rather, they are controls of type
CommandBarControl. Command-bar controls can be added to a menu bar, toolbar, menu,
submenu, or shortcut menu. (Think of toolbars, menu bars, and so on as "forms" upon which you
place controls.)
Every command-bar control is an object of type CommandBarControl and so it belongs to the
CommandBarControls collection. (We are not saying that the Type property of a command-bar
control is CommandBarControl.) In addition, every command-bar control is an object of one of
the following three object types:
This dual identity of CommandBarControl objects allows the various types of command-bar
controls to possess on the one hand a common set of properties and methods (those of the
CommandBarControl object) and, on the other hand, an additional set of properties and methods
that reflects the diversity of these controls. This makes sense, since, for instance, text boxes are
quite different from popup controls. Moreover, as we will see, CommandBarPopup objects need a
special property (called Controls) that provides access to the associated menu's controls. (The
other types of CommandBarControl objects do not need, and do not have, this property.)
The Type property of a CommandBarControl helps to identify the data type of the control. It can
assume any of the values in the following enum:
Enum MsoControlType
msoControlCustom = 0
msoControlButton = 1 ' CommandBarButton
msoControlEdit = 2 ' CommandBarComboBox
msoControlDropdown = 3 ' CommandBarComboBox
msoControlComboBox = 4 ' CommandBarComboBox
msoControlButtonDropdown = 5 ' CommandBarComboBox
msoControlSplitDropdown = 6 ' CommandBarComboBox
msoControlOCXDropdown = 7 ' CommandBarComboBox
msoControlGenericDropdown = 8
msoControlGraphicDropdown = 9 ' CommandBarComboBox
msoControlPopup = 10 ' CommandBarPopup
msoControlGraphicPopup = 11 ' CommandBarPopup
msoControlButtonPopup = 12 ' CommandBarPopup
msoControlSplitButtonPopup = 13 ' CommandBarPopup
msoControlSplitButtonMRUPopup = 14 ' CommandBarPopup
msoControlLabel = 15
msoControlExpandingGrid = 16
msoControlSplitExpandingGrid = 17
msoControlGrid = 18
msoControlGauge = 19
msoControlGraphicCombo = 20 ' CommandBarComboBox
End Enum
The comments that follow some of the constants in this enum indicate the data type of the control.
This information comes from the Microsoft help files. The missing comments mean either that
some command-bar controls do not belong to one of the three data types in question or else that
the help file has not kept up with later additions to the enum.
Search JabSto ::

Custom Search