CommandBarComboBox Object

CommandBarComboBox
CommandBar

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 | IsPriorityDropped 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 | Move Method | RemoveItem Method | Reset Method | SetFocus Method

Events | Change Event

Parent Objects

Child Objects | CommandBar Object

See Also | AddItem Method