trprasad78
Member
Hi
I would like to send auto email by using information from Excel.
I have png files
D:\Dec\AutoMail\Image\ folder.
Image has to embed to respective email and send it.
Please check below vba code and suggest the changes need to done.
sample file attached.
Thank you in advance.
I would like to send auto email by using information from Excel.
I have png files
D:\Dec\AutoMail\Image\ folder.
Image has to embed to respective email and send it.
Please check below vba code and suggest the changes need to done.
sample file attached.
Thank you in advance.
Code:
Sub sendeMail()
Dim olApp As Outlook.Application
Dim olMail As Outlook.MailItem
For i = 2 To ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
Set olApp = New Outlook.Application
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.To = Cells(i, 2).Value
.CC = Cells(i, 3).Value
' .Body = Cells(i, 4).Value
.Subject = Cells(i, 5).Value
' .Attachments.Add Cells(i, 6).Value
.HTMLBody = .Body & "<br><B>Embedded Image:</B><br>" _
& "<img src= Cells(i, 6).Value" & "width='500' height='200'><br>" _
& "<br>Best Regards, <br>Sumit</font></span>"
.Display
''.Send
End With
Set olMail = Nothing
Set olApp = Nothing
Next
End Sub