Solved

How can I code in Excel VBA for a picture to be emailed?

Posted on 2010-11-26
2
321 Views
Last Modified: 2012-05-10
In Excel, I have written a macro that creates an email (pre-populated with the person in the "To" field, the "BCC" field, the "Subject" field, and some simple text in the message body area).

However, I do not know how to get a picture pre-populated into the message body area.

Any ideas?
0
Comment
Question by:HaimD
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 37

Accepted Solution

by:
TommySzalapski earned 500 total points
ID: 34219230
Of course you can't do it in a plain text email. So you'll be using .HTMLBODY not .Body. Something like this should work. It will embed when it sends.
.HTMLBODY = "<HTML><Head></Head><Body>Text goes here.<br><img SRC=C:\ImagePath\Imagename.jpg><br>More text here.</Body></HTML>"
0
 
LVL 12

Expert Comment

by:sstampf
ID: 34225768
If you are planning to insert a chart as picture and you are using Outlook you may try the link below:
http://www.rondebruin.nl/mail/folder2/chart.htm

I also got the code below which might can be useful to you (source: http://www.codeforexcelandoutlook.com/excel-vba/send-email-from-excel/)
.HTMLBody = "<BODY><FONT face=Arial color=#000080 size=2></FONT>" & _
            "<IMG alt='' hspace=0 src='cid:EmailTemp.gif' align=baseline 0rder=0>&nbsp;" & _
            "<br><br>Plus add any text you want</BODY>"

Open in new window

0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question