Returns or sets an item in the command bar combo box control. Read/write String.
Note This property is read-only for built-in combo box controls.
expression.List(Index)
expression Required. An expression that returns a CommandBarComboBox object.
Index Required Long. The list item to be set.
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