+ Reply to Thread
Results 1 to 19 of 19

Embedding a JPEG image into email body

  1. #1
    Registered User
    Join Date
    05-30-2013
    Location
    Connecticut
    MS-Off Ver
    Excel 2010
    Posts
    80

    Embedding a JPEG image into email body

    I have the following code and want to include a JPEG image from my desktop at the end of the code.
    Please Login or Register  to view this content.
    Anyone know how?

  2. #2
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Embedding a JPEG image into email body

    something like this...
    Please Login or Register  to view this content.
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    You need to attach the image then use an IMG tag with the src as "cid:imagename.jpg".

    Oh, and instead of Body you need to use HTMLBody.
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    05-30-2013
    Location
    Connecticut
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Embedding a JPEG image into email body

    John, a small box appeared with an x where the picture was supposed to be in the email. I did change the path of the picture


    Norie,

    Can you please show exactly what you mean and where it needs to go. I am not the best with VBA.
    Thanks

  5. #5
    Registered User
    Join Date
    05-30-2013
    Location
    Connecticut
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Embedding a JPEG image into email body

    I really appreciate you guys helping out and I'm sure you are busy, but if you have time now it would help a lot if we could work through this asap as I am being rushed for this Macro.

    Thanks again,

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Embedding a JPEG image into email body

    Have a look here http://www.mrexcel.com/forum/excel-q...ook-email.html.

    I know it's a long thread, from a different forum, but it should help.

  7. #7
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Embedding a JPEG image into email body

    Hi bocaj,
    it should work if you have a picture on yr desktop(or depend on yr path) as png, (check the full path of yr picture, right click, properties, location) I use this code with our comp logo for sending diff emails and it works fain.

  8. #8
    Registered User
    Join Date
    05-30-2013
    Location
    Connecticut
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Embedding a JPEG image into email body

    It is a .JPG, does it have to be a png

  9. #9
    Registered User
    Join Date
    05-30-2013
    Location
    Connecticut
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Embedding a JPEG image into email body

    Norie,

    I cannot see the code on that forum as I am not a member.

  10. #10
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Embedding a JPEG image into email body

    tried with a jpg and it works...

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Embedding a JPEG image into email body

    This is how you attach an image called TAT_Summary.jpg which you have previously attached to the email, oEmail.
    Please Login or Register  to view this content.
    I would post the complete code but you've only posted the line of code for setting the body of an email.


    John55

    Are you sure the recipient can see the image?

    If they can it would suggest they have access to the desktop of the user who sent the email, which might not be a good thing.

  12. #12
    Registered User
    Join Date
    05-30-2013
    Location
    Connecticut
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Embedding a JPEG image into email body

    John, Norie was right, the recipient can't see the image. Norie, I'm going to be honest I really don't know where that code belongs or where I should attach the image. I've uploaded the code below for you to more easily assist. Thanks again!
    Please Login or Register  to view this content.

  13. #13
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Embedding a JPEG image into email body

    Quote Originally Posted by Norie View Post

    John55

    Are you sure the recipient can see the image?

    If they can it would suggest they have access to the desktop of the user who sent the email, which might not be a good thing.
    Hi Norie,
    yes I am sure they rcv the picture in the signature and I use this piece of code. No, they do not have acces to my desktop.

  14. #14
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    John55

    Is the URL, C:\..., definitely as you posted?

    Wait a minute, are you putting the image in your signature?

    If you are that's not the same as putting it in the body if the email, which I assume is what the OP wants - though of course I may be wrong.
    Last edited by Norie; 06-21-2013 at 11:41 AM.

  15. #15
    Registered User
    Join Date
    05-30-2013
    Location
    Connecticut
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Embedding a JPEG image into email body

    Norie,

    Can you please show me where and what I need to add?

    Thanks

  16. #16
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    This is from memory so might be slightly out - not at a computer to check.
    Please Login or Register  to view this content.

  17. #17
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Embedding a JPEG image into email body

    Norie, it's in the code as I posted, I said "signature" because is below of my text...
    few minutes ago I asked my colleague to send to me a test, I rcvd it with picture! that's it!
    I am sorry for bocaj315, I provided exacltly what I use every day!

  18. #18
    Registered User
    Join Date
    05-30-2013
    Location
    Connecticut
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Embedding a JPEG image into email body

    I've got it. John, my original post skipped cells if they were blank--that's why there were all of those if statements. I've tried putting the same code in my HTML body but there must be a different syntax required. ANy ideas?

  19. #19
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Embedding a JPEG image into email body

    just replace vbNewLine with "<br/>"
    Please Login or Register  to view this content.

  20. #20
    Registered User
    Join Date
    05-30-2013
    Location
    Connecticut
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Embedding a JPEG image into email body

    That only starts a new line. In order to check if the cells are blank and skip them if they are, I'm pretty sure there needs to be some sort of if statement followed by vbnullstring.

  21. #21
    Forum Contributor
    Join Date
    06-20-2013
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: Embedding a JPEG image into email body

    I am asking a similar question in my forum.

    Please Login or Register  to view this content.
    After the img src = cid: I need to put my directory to my image source, right??

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1