How to Quickly Add Selected Cells in Excel Worksheet as an Image Attachment to Your Outlook Email

Many users wish to convert the selected cells in an Excel worksheet to an image and then attach the image to an Outlook email. This article will introduce a method to get it with ease.

In my previous article – “2 Methods to Quickly Send Selected Cells in an Excel Worksheet as an Outlook Email”, I’ve introduced 2 ways to embed the selected cells into the body of an email quickly. But, some users would like to convert the selected cells into an image and attach the image to an email. In response to this wish, here we will expose a piece of VBA code, which can realize it like a cork.

Quickly Add Selected Cells in Excel Worksheet as an Image Attachment to Your Outlook Email

Add Selected Cells in Excel Worksheet as an Image Attachment to Email

  1. At the very outset, open the source Excel workbook and then access the right worksheet.
  2. Then press “Alt + F11” keys to access Excel VBA editor.
  3. Next you ought to enable Outlook Object firstly.
  • To start with, click on “Tools” in the toolbar.
  • Then from the drop down list, choose “References”.
  • In the new dialog box, find “Microsoft Outlook Object Library” and mark the checkbox before it.Enable Outlook Object
  1. Subsequently, you need open the “ThisWorkbook” project and copy the VBA code below into its window.
Sub SendSelectedCells_EmailAttachment()
    Dim objSelection As Excel.Range
    Dim objThisWorksheet As Excel.Worksheet
    Dim objFileSystem As Object
    Dim strTempFolder, strImageName, strImageFile As String
    Dim objOutlookApp As Outlook.Application
    Dim objNewMail As Outlook.MailItem
    'Copy the selected cells
    Set objSelection = Selection
    'Specify the worksheet
    Set objThisWorksheet = ThisWorkbook.Worksheets("Sheet1")
    'Export the selected cells as an image file
    Set objFileSystem = CreateObject("Scripting.FileSystemObject")
    strTempFolder = objFileSystem.GetSpecialFolder(2).Path & "\"
    strImageName = "Capture from " & ThisWorkbook.Name
    strImageFile = strTempFolder & strImageName & ".jpg"
    With objThisWorksheet.ChartObjects.Add(objSelection.Left, objSelection.Top, objSelection.Width, objSelection.Height)
        .Chart.Export strImageFile, "JPG"
    End With
    'Attach the image to a new Outlook email
    Set objOutlookApp = CreateObject("outlook.application")
    Set objNewMail = objOutlookApp.CreateItem(olMailItem)
    With objNewMail
        .Attachments.Add strImageFile
    End With
End Sub

VBA Code - Add Selected Cells in Excel Worksheet as an Image Attachment to Your Outlook Email

  1. After that, you can add the new macro to Quick Access Toolbar. Access “Excel Options” and shift to “Quick Access Toolbar” tab. Then take the steps shown in the screenshot below to complete it.Add New Macro to QAT
  2. Eventually, you can have a try.
  • Firstly, select the specific cells.
  • Then hit the button in Quick Access Toolbar.Select Cells & Run Macro
  • At once, a new Outlook email will popup, in which an image copied from selected cells has been attached, like the following picture:Attached Image File

Solve Outlook Problems Swiftly

During using your Outlook, you must have ever encountered a variety of issues, like frequent error messages, Outlook freezes and even Outlook corruption. Thus, it is necessary for you to equip your Outlook with a powerful and reliable repair tool, such as DataNumen Outlook Repair. It is well versed in fixing Outlook issues.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including fix sql and outlook repair software products. For more information visit

Comments are closed.