Solved

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

Posted on 2012-12-28
2
5,646 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
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…

838 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