Initially, one of the most confusing aspects of the Office menu system is that the items that appear on a menubar are not menus, or even names of menus. Rather, they are controls of type CommandBarControl. Command bar controls can be added to a menubar, toolbar, menu, submenu, or shortcut menu.
Every command bar control is an object of type CommandBarControl. In addition, every command bar control is an object of one of the following three object types:
This allows the various types of command bar controls to possess a common set of properties and methods (those of the CommandBarControl object), as well as an additional set of properties and methods that reflects the diversity of these controls. (After all, text boxes are quite different from popup controls, for instance.)
To create and add a command bar control to a command bar, use the Add method of the CommandBarControls collection. This method returns a CommandBarButton, CommandBarComboBox, or CommandBarPopup object, depending on the value of the
Type parameter (see later in this section). The syntax is:
Type, Id, Parameter,_
Type is the type of control to be added to the specified command bar. Table 21-1 shows the possible values for this parameter, along with the corresponding control and the return type of the Add method.
Table 21-1. msoControlType Values for the Type Parameter ...