Solved

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

Posted on 2010-11-26
2
302 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now