Table of contents
Collapse the table of content
Expand the table of content

CommandBarComboBox.ListCount Property (Office)

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

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 component of the Microsoft Office Fluent user interface. For more information, search Help for the keyword "ribbon."


expression. ListCount

expression A variable that represents a CommandBarComboBox object.


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.

Set myBar = CommandBars _ 
    .Add(Name:="Custom", Position:=msoBarTop, _ 
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

See also


CommandBarComboBox Object

Other resources

CommandBarComboBox Object Members

© 2018 Microsoft