Working with command bars

Microsoft Outlook

Working with command bars

In Microsoft Outlook 2000, toolbars, menu bars, and shortcut menus are all controlled programmatically as one type of object: command bars. All the following items are represented in Microsoft Visual Basic by CommandBar objects:

  • Menu bars, toolbars, and shortcut menus
  • Menus on menu bars and toolbars
  • Submenus on menus, submenus, and shortcut menus

You can modify any built-in menu bar or toolbar, and you can create and modify custom toolbars, menu bars, and shortcut menus to deliver with your Visual Basic application. You can present the features of your application as buttons on toolbars or as groups of command names on menus. Because toolbars and menus are both command bars, you use the same kind of controls on both of them. Menu bars and toolbars can both contain menus.

In Visual Basic, buttons and menu items are represented by CommandBarButton objects. The pop-up controls that display menus and submenus are represented by CommandBarPopup objects.

You can also add text boxes, drop-down list boxes, and combo boxes to any command bar. These three types of controls are all represented in Visual Basic by CommandBarComboBox objects.

Note   Although they share similar appearances and behaviors, command bar controls and ActiveX controls are not the same. You cannot add ActiveX controls to command bars, and you cannot add command bar controls to documents or forms.

The built-in command bar controls in Outlook are also represented by CommandBarButton, CommandBarPopup, and CommandBarComboBox objects, but their appearances and behaviors may be different from those you can add yourself. You can modify the location and appearance of built-in controls, you cannot modify their built-in behavior.