VikR
VikR

Reputation: 5142

Excel VBA: Can't Access Form Control?

I'm using the latest Office 365 Excel on OS X. I've created a List Box Form Control (ActiveX controls don't seem to be available in OS X), called wb_from:

enter image description here

I'm trying to access this List Box from VBA using this code:

Sub my_Import()

    Dim MailStr As String

    MailStr = ""

    If wb_from.SelectedItems.Count = 0 Then
        MsgBox "No User Selected"
        Exit Sub
    End If
    For i = 0 To (wb_from.Items.Count - 1)
        If wb_from.Selected(i) Then
            MailStr = MailStr & wb_from.Items.Item(i) & "; "
        End If
    Next i
    a = 100

End Sub

Excel is giving me an object required error:

enter image description here

How can I correct this?

Upvotes: 0

Views: 222

Answers (1)

RetiredGeek
RetiredGeek

Reputation: 3158

What cell did you link that control to via Format Control? That cell address should be used in your code.

Upvotes: 1

Related Questions