Gets the number of list items in a CommandBarComboBox control. Read-only.

Note
The use of CommandBars in some Microsoft Office applications has been superseded by the new Ribbon user interface. For more information, search help for the keyword "Ribbon."

Syntax

expression.ListCount

expression A variable that represents a CommandBarComboBox object.

Example
This example checks the number of items in the combo box on the command bar named "Custom." If there aren't three items in the list that the procedure produces, the example displays a message advising the user that the combo box may be damaged and asks the user to reinstall the application.

Visual Basic for Applications
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 .Caption = "Stock Data" .DescriptionText = "View Data For Stock" End With If CommandBars("Custom").Controls(1).ListCount _ > 4 Then MsgBox ("ComboBox appears to be damaged." & _ " Please reinstall.") End If
display the number of items listed within a command bar control list count List Count Property listcount ListCount Property ofv return the number of list items in the command bar combo box control view total items in the combo box control on the command bar

See also: