Page 398 - Microsoft Office Excel 2003 Programming Inside Out
P. 398
Part 5: Manipulating Excel Objects
Microsoft Office Excel 2003 Programming Inside Out
Table 17-3. Key Properties and Methods of the CommandBarControls
Collection
Property/Method Description
Add(Type, Id, Parameter, Method: creates a new command bar object and adds it to the
Before, Temporary) CommandBarControls collection. Type specifies the general type of
control that should be added. It can be one of the following:
msoControlButton, msoControlEdit, msoControlDropDown,
msoControlComboBox, or msoControlPopup; Id is an integer value
that specifies a built-in control. A value of 1 or omitting this
parameter will add a custom control; Parameter contains
programmer-defined information that can be used by the control’s
OnAction routine to determine how to process this instance of the
control; and Before contains the position of the new control in the
collection. If omitted, the control will be added at the end of the
collection; Temporary, when True, means that the control will be
automatically deleted when Excel ends.
Count Property (read-only): returns the number of CommandBars in the
collection.
Item(Index) Property: returns the command bar object specified by Index.
Although there are many different types of controls (listed in Table 17-4), they can be loosely
grouped into four major categories: Normal, Button, Combo Box, and Pop-up. Normal con
trols have all the properties and methods associated with the CommandBarControl object,
whereas Buttons, Combo Boxes, and Pop-ups have additional properties and methods.
Table 17-4. Command Bar Control Types
Constant Description
msoControlActiveX Normal
msoControlAutoCompleteCombo Normal
msoControlButton Contains a single menu item, an icon button, a
menu item with an icon, or an icon with text below
the image
msoControlButtonDropdown Combo Box
Chapter 17
msoControlButtonPopup Pop-up
msoControlComboBox Combo Box
msoControlCustom Button
msoControlDropdown Combo Box
msoControlEdit Combo Box
msoControlExpandingGrid Normal
msoControlGauge Normal
372

