ListCount Property

Applies To

CommandBarComboBox object.

Description

Returns the number of list items in the specified command bar combo box control. Read-only Long.

See Also

Execute method, List property, ListBy property, ListHeaderCount property, ListIndex property.

Example

This example checks the number of items in the combo box control on the command bar named "Custom." If there are more than three items in the list, the list is cleared and a new first item is added and displayed as the default for the combo box control.

Set myBar = CommandBars("Custom")
Set myControl = myBar.Controls(2)
With myControl
    If .ListCount > 3 Then
    .Clear
    .AddItem Text:="Floyd", Index:=1
    .ListIndex = 1
    End If
End With