Solved

Excel VBA-  take Screenshot and then Embed in Email Message Body using Outlook

Posted on 2012-12-28
2
5,300 Views
Last Modified: 2013-01-18
Hi Experts,

Is there a way to take a screen shot of a specific sheet and then Embed the image into the body of an email message using Outlook 2010?

I want the end user to be able to click a button named "Email" and then have the data on the worksheet captured in screenshot form then embedded and sent via email.

sample screenshotSample-Workbook.xlsm
0
Comment
Question by:"Abys" Wallace
2 Comments
 
LVL 9

Accepted Solution

by:
shorvath earned 500 total points
ID: 38728581
Replace your  cmdEmail code with this code

Private Sub cmdEmail_Click()
Dim oRange As Range
Dim oCht As Chart
Dim oImg As Picture

Set oRange = Range("A1:P37")
Set oCht = Charts.Add

oRange.CopyPicture xlScreen, xlPicture
oCht.Paste
oCht.Export Filename:="C:\Temp\SavedRange.jpg", Filtername:="JPG"

Screenshot_Mail "Sample Email Address" & "; " & "Sample Email Address", "Sample Email Address" & _
 "; " & "Sample Email Address" & "; " & "Sample Email Address", "Rep II Case Productivity Report", "<font color=red>" & _
"<I>" & "Below is a Snapshot View of the Rep II Case Productivity Report:  " & "</font>" & "</I>" & _
"<BR>" & "<BR>" & "<BODY><FONT face=Arial color=#000080 size=2></FONT>" & _
"<IMG alt='' hspace=0 src='C:\Temp\SavedRange.jpg' align=baseline border=0>&nbsp;</BODY>"

DoEvents
oCht.Delete

End Sub

Open in new window

0
 

Author Closing Comment

by:"Abys" Wallace
ID: 38728652
Thank you @shorvath!
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;…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

932 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

11 Experts available now in Live!

Get 1:1 Help Now