Inserting a JPG file into the body of an email

NewOrderFac33

Well-known Member
Joined
Sep 26, 2011
Messages
1,275
Office Version
  1. 2016
  2. 2010
Platform
  1. Windows
Good afternoon,
I'm generating an email in VBA and I want to include a JPEG file in the body of the email:

I currently have:
Code:
Set InfoSheet = Sheets("InfoSheet")
Dim PicFile As Range
Set PicFile = InfoSheet.Range("PicFile")
MsgBody = MsgBody & "<HTML><BODY><IMG src='PicFile' /></BODY></HTML>"
where "PicFile" is a worksheet cell contaniing the full pathname of a JPEG file.
Hpwever, when I run the following code:
Code:
With OutMail
        .To = Email_To
        .CC = Email_CC
        .Subject = Email_Subject
        .HTMLbody = MsgBody
        '.attachments.Add Email_Attachment_10
        .Display
        '.Send
    End With
my previewed message includes the pathname of the .jpg file as a string, but not the .jpg itself.
Can anyone give me a pointer as to where I'm going wrong, please?
Thanks in advance
Pete
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,215,515
Messages
6,125,279
Members
449,220
Latest member
Excel Master

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top