There is no ".Selected" in the intellisense for either the object directly, or the object.ControlFormat. When I execute this code, Excel fails with the error message: "Runtime Error 438. Object doesn't support this property or method."
I've scoured the net looking for help, but couldn't find any that addressed this issue.
Anybody have insight on how to either fix the problem or a workaround where I can see what items are selected and dump them into a collection?
' I tried all three modes of the listbox (single, multi, extended - select), which is available when right-clicking the control.
Expand|Select|Wrap|Line Numbers
- ' Dimension variables and objects
- Dim ws As Excel.Worksheet
- Dim lst As Shape
- Dim cList As Collection ' The index of the "Selected" currencies
- Dim i As Integer ' Loop variable
- ' Set objects
- Set ws = Application.Sheets(MAIN_SHEET)
- Set lst = ws.Shapes("lstCurrencies")
- Set cList = New Collection
- ' Set the Selected Items
- With lst.ControlFormat
- For i = 1 To .ListCount
- If .Selected(i) Then ' <---- FAILS HERE
- cList.Add lst.ControlFormat.List(i)
- .Selected(i) = False
- End If
- Next i
- End With