ListIndex Property

Applies To

CommandBarComboBox object.

Description

Returns or sets the index number of the selected item in the list portion of the command bar combo box control. If nothing is selected in the list, this property returns zero. Read/write Long.

Note   This property fails when applied to controls other than list controls.

Remarks

Setting the ListIndex property causes the specified control to select the given item and execute the appropriate action in the application.

See Also

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

Example

This example runs an existing procedure, based on the selection in the combo box. The text in the combo box can be anything, because the example uses either the ListIndex property or the index number of the text entry to determine which procedure to run.

With myControl
    Select Case .ListIndex
        Case 1
            chartcourse
        Case 2
            displaygraph
        Case Else
            MsgBox "invalid choice"
    End Select
End With