CommandBarComboBox.List Property (Office)

Gets or sets an item in the CommandBarComboBox control. Read/write.

Note

The use of CommandBars in some Microsoft Office applications has been superseded by the new ribbon component of the Microsoft Office Fluent user interface. For more information, search Help for the keyword "ribbon."

Syntax

expression. List( _Index_ )

expression A variable that represents a CommandBarComboBox object.

Parameters

Name Required/Optional Data Type Description
Index Required Integer The list item to be set.

Remarks

Note

This property is read-only for built-in combo box controls.

Example

This example checks the fourth list item in the combo box control whose caption is "Stock Data" on the command bar named "Custom." If the item isn't "View News," the example displays a message advising the user that the combo box may be damaged and asks the user to reinstall the application.

Set myBar = CommandBars _ 
    .Add(Name:="Custom", Position:=msoBarTop, _ 
    Temporary:=True) 
With myBar 
    .Controls.Add Type:=msoControlComboBox, ID:=1 
    .Visible = True  
End With 
With CommandBars("Custom").Controls(1) 
    .AddItem "Get Stock Quote", 1 
    .AddItem "View Chart", 2 
    .AddItem "View Fundamentals", 3 
    .AddItem "View News", 4 
    .Caption = "Stock Data" 
    .DescriptionText = "View Data For Stock" 
End With 
If CommandBars("Custom").Controls(1).List(4) _ 
     > "View News" Then 
MsgBox ("Stock Data appears to be damaged." & _ 
     " Please reinstall application.") 
End If

See also

CommandBarComboBox Object

CommandBarComboBox Object Members