Name
commandbarcombobox
.List(Index
)
Synopsis
Returns one or all of the items in the list. You can get the selected item by using the Text
property or by using this method in combination with the ListIndex
property as shown here:
Sub ShowSelection( ) Dim cbo As CommandBarComboBox , str As String ' Get the control Set cbo = CommandBars("Worksheet Menu Bar").FindControl _ (msoControlDropdown, , "cboSelectText", , True) ' Get the selection. str = cbo.list(cbo.ListIndex) ' Display selection. MsgBox "You selected: " & str End Sub
Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.