-
collections
Does anyone know what changes I need to make to the code below so that it does not give me an error that says "For each control variable must be Variant or Object. Thank you for your help.
Dim myColl As New Collection
Private Sub cmdAdd_Click()
If Len(txtInput) > 0 Then
myColl.Add txtInput
txtInput = ""
End If
End Sub
Private Sub cmdDisplay_Click()
Dim item As String
lstOutput.Clear
For Each item In myColl
lstOutput.AddItem item
Next item
End Sub
Private Sub Form_Load()
Set myColl = New Collection
End Sub
Archie Kantzavelos
-
Re: collections
Declare item to be of type variant or object
Change this Dim item as string
To this Dim item as variant