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

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Forum statistics

Threads
1,215,831
Messages
6,127,147
Members
449,364
Latest member
AlienSx

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