Using the following code my workbook gets emailed to the appropriate recipients from a listbox but I get an error after execution. Any idea as to why? Thanks!
Code is:
Private Sub CommandButton4_Click()
Dim email_person
Dim entry_counter As Integer
entry_counter = -1
Do While entry_counter <= ListBox2.ListCount
entry_counter = entry_counter + 1
email_person = ListBox2.List(entry_counter, 0)
ActiveWorkbook.SendMail Recipients:=email_person, Subject:="Form 102 for Plate # " & Range("B1")
Loop
End Sub
Error is:
Run-time error '381':
Could not get the List property. Invalid property array index.
Code is:
Private Sub CommandButton4_Click()
Dim email_person
Dim entry_counter As Integer
entry_counter = -1
Do While entry_counter <= ListBox2.ListCount
entry_counter = entry_counter + 1
email_person = ListBox2.List(entry_counter, 0)
ActiveWorkbook.SendMail Recipients:=email_person, Subject:="Form 102 for Plate # " & Range("B1")
Loop
End Sub
Error is:
Run-time error '381':
Could not get the List property. Invalid property array index.