At times, instead of copying the Excel worksheet into an email’s body, you may want to insert the screenshot of the worksheet. Thus, this article will show 2 methods to get it.
Many users would like to export a screenshot of a specific Excel worksheet and then insert the screenshot into the message body of an Outlook email. Only in the screenshot, the cell values can’t be changed. And the screenshot can be viewed even if the recipients don’t install MS Excel on their computers.
This can be realized by 2 means. The first one is by the inbuilt feature – “Insert” > “Screenshot”, which is elaborately introduced in the following Method 1. And the second one is using a bit of scripting, as shown in the Method 2. Now, read on to get them in detail.
Method 1: Insert Screenshot of Excel Window
- First off, open the Excel worksheet that you want to insert into email.
- Then, launch Outlook and create a new email.
- Next, in the Message window, switch to “Insert” tab.
- Subsequently, click “Screenshot” button.
- In the “Available Windows” list, select the screenshot of the Excel worksheet.
- At once, the screenshot of the Excel worksheet will be inserted.
- Now, you can crop the screenshot at will.
Method 2: Copy the Screenshot of Excel Worksheet with VBA
- At the very outset, open the Excel file.
- Then, press “Alt + F11” to trigger Excel VBA editor.
- Next, add the reference to “MS Outlook Object Library” and “MS Word Object Library” according to “How to Add an Object Library Reference in VBA“.
- After that, copy the following VBA code into a project or module.
Sub ExportInsert_ScreenshotOfSheet_Mail() Dim objSheet As Excel.Worksheet Dim objUsedRange As Excel.Range Dim objOutlookApp As Outlook.Application Dim objMail As Outlook.MailItem Dim objMailDocument As Word.document 'Change "Sheets(1)" to the specific worksheet number Set objSheet = ActiveWorkbook.Sheets(1) Set objUsedRange = objSheet.UsedRange 'Copy the screenshot of the sheet objUsedRange.CopyPicture xlScreen, xlPicture Set objOutlookApp = CreateObject("Outlook.Application") Set objMail = objOutlookApp.CreateItem(olMailItem) objMail.Display Set objMailDocument = objMail.GetInspector.WordEditor 'Paste the copied screenshot objMailDocument.Range(0, 0).Paste End Sub
- Later, press “F5” to run this macro.
- Immediately, a new email will display.
- In the small dialog box, click “Allow” button.
- Lastly, the screenshot of the Excel worksheet will be inserted into the mail body.
When Confronting Outlook File Damage
If you accidentally download any virus-infected attachments, your Outlook file is very likely to be attacked and thereby become compromised. In such a situation, you have to firstly run antivirus software to kill the viruses. Afterwards, you need to invest in a robust third party repair utility, such as DataNumen Outlook Repair, which can repair PST file without breaking a sweat.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including recover mdf and outlook repair software products. For more information visit www.datanumen.com
Code didn’t work. 3rd dim statement not defined