m_vishal_c
Board Regular
- Joined
- Dec 7, 2016
- Messages
- 209
- Office Version
- 365
- 2016
- Platform
- Windows
HI i have encountered this below error. i have for example 5 email id, name and attachment path in excel file. i want to send email to them with attachment . this below code does not pick up attachment .
Please guide me
there are 5 email ids and 5 different attachment paths
i much appreciate yoursupport and time
thanks
Please guide me
Code:
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
toList = Cells(i, 4) 'gets the recipient name
eSubject = Cells(i, 8) & " " & Cells(i, 9)
eBody = "Dear " & Cells(i, 1) & vbCrLf & vbCrLf & Cells(i, 5) & vbCrLf & vbCrLf & Cells(i, 10) & vbNewLine & vbCrLf & Cells(i, 11) & vbNewLine & Cells(i, 12)
Set rng = sh.Cells(i, 7) 'this is attachment location(path)
On Error Resume Next
With OutMail
.To = toList
.CC = ""
.BCC = ""
.Subject = eSubject
.Body = eBody
.bodyformat = 1
.Attachments.Add Cells(i, 7)
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
there are 5 email ids and 5 different attachment paths
i much appreciate yoursupport and time
thanks