• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

embed image in outlook email

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.



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
 

Attachments

  • Automail.xlsm
    53.7 KB · Views: 12
Hello Prasad.

Hope you are doing good...I think i have provided you the code which you attachment as per your earlier requirement which will not work for the current question.

So let me know what actually you are looking for.

i think you wanted to send mail based on the Email id it should go to the folder and pick the picture and embedded in the body you mean...if am correct..

Correct me if am wrong..
 
Hello Prasad.

Hope you are doing good...I think i have provided you the code which you attachment as per your earlier requirement which will not work for the current question.

So let me know what actually you are looking for.

i think you wanted to send mail based on the Email id it should go to the folder and pick the picture and embedded in the body you mean...if am correct..

Correct me if am wrong..
Hi Thank you for asking, I am doing good.

Actually I got another code where it copy past directly to outlook as HTML body.
So not necessarily to convert as image.

That code is working.fine.

Thank you for your support
 
Back
Top