Solved

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

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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;…
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 …
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

758 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

21 Experts available now in Live!

Get 1:1 Help Now