If someone would so kind as to review the following code, and point me in the right direction.
I'm using a table with the following headers as my list.
Email - First Name - Last Name - Clients - Attach1 - Attach2 - Attach3 - Attach4 - Attach5
All messages will have at least one attachment but some have as many as 5.
The issue with my current code is when I read a record with only 1 attachment it errors out on the next attempt to add the attachment and the cell is empty.
Runtime error
"Cannot find this file. Verify the path and file name are correct"
emailList ThisWorkbook.Worksheets("CoordinatorList").Range("TblEmailList").Value
For i = LBound(emailList) To UBound(emailList)
Set emailItem = outlookApp.CreateItem(0)
emailEmail = emailList(i, 1) ' Email Column
emailName = emailList(i, 2) ' First Name Column
ClientName = emailList(i, 4) ' Clients Column
AttachedFiles1 = emailList(i, 5) ' Attachments Column
AttachedFiles2 = emailList(i, 6) ' Attachments Column
AttachedFiles3 = emailList(i, 7) ' Attachments Column
AttachedFiles4 = emailList(i, 8) ' Attachments Column
AttachedFiles5 = emailList(i, 9) ' Attachments Column
' Setup values for the email.
emailSubject = SrvMonth & " " & "Service Logs " & "For " & ClientName
emailBody = "<html><body> <font face=OpenSans color=#000000 size=3> </p> <p>" & emailName & "," & "<br> Please find the attached Monthly Service Logs for all your Pine Castle ResHab Clients."
emailItem.Attachments.Add attPath & AttachedFiles1 emailItem.Attachments.Add attPath & AttachedFiles2 emailItem.Attachments.Add attPath & AttachedFiles3 emailItem.Attachments.Add attPath & AttachedFiles4 emailItem.Attachments.Add attPath & AttachedFiles5
Thank you in advance for any and all suggestions
OldCityCat