CommandBarComboBox Object
Description
Represents a combo box control on a command bar.
Using the CommandBarComboBox Object
Use Controls(index), where index is the index number of the control, to return a CommandBarComboBox object. (The Type property of the control must be msoControlEdit, msoControlDropdown, msoControlComboBox, msoControlButtonDropdown, msoControlSplitDropdown, msoControlOCXDropdown, msoControlGraphicCombo, or msoControlGraphicDropdown.)
The following example adds two items to the second control on the command bar named "Custom," and then it adjusts the size of the control.
Set combo = CommandBars("Custom").Controls(2)
With combo
.AddItem "First Item", 1
.AddItem "Second Item", 2
.DropDownLines = 3
.DropDownWidth = 75
.ListIndex = 0
End With
You can also use the FindControl method to return a CommandBarComboBox object. The following example searches all command bars for a visible CommandBarComboBox object whose tag is "sheet assignments."
Set myControl = CommandBars.FindControl _
(Type:=msoControlComboBox, Tag:="sheet assignments", Visible:=True)
Properties
Application property, BeginGroup property, BuiltIn property, Caption property, Creator property, DescriptionText property, DropDownLines property, DropDownWidth property, Enabled property, Height property, HelpContextId property, HelpFile property, Id property, Index property, Left property, List property, ListCount property, ListHeaderCount property, ListIndex property, OLEUsage property, OnAction property, Parameter property, Parent property, Priority property, Style property, Tag property, Text property, TooltipText property, Top property, Type property, Visible property, Width property.
Methods
AddItem method, Clear method, Copy method, Delete method, Execute method (Command Bar controls), Move method, RemoveItem method, Reset method, SetFocus method.
See Also
Add method (CommandBarControls collection), AddItem method.