sharky12345
Well-known Member
- Joined
- Aug 5, 2010
- Messages
- 3,421
- Office Version
- 2016
- Platform
- Windows
Can someone please tell me how I should be declaring the following?
The listbox items are all numeric numbers but joined with a semi-colon so they can be used in an email address box. I've tried declaring as a String but it throws an error saying 'expected array'.
Code:
With Me.ListBox1For i = 0 To .ListCount - 1
If .Selected(i) Then
ReDim Preserve arrContacts(cnt)
arrContacts(cnt) = .List(i, 0)
cnt = cnt + 1
End If
Next i
End With
If cnt > 0 Then
Students = Join(arrContacts, "; ")
End If
The listbox items are all numeric numbers but joined with a semi-colon so they can be used in an email address box. I've tried declaring as a String but it throws an error saying 'expected array'.