How to Quickly Export an Outlook Email as an Image File

Some users would like to export an Outlook email as an image file, such as a jpg file. Therefore, in this article, we will introduce you how to get it via Outlook VBA code.

You must have learned a variety of tricks for exporting an email as text file, Word document and so on. Then, how about exporting an email as picture like JPG file? Apparently, Outlook doesn’t have this function. But, thereinafter, we will share a quick means with you.

Quickly Export an Outlook Email as an Image File

Quickly Export an Outlook Email as an Image File

  1. For a start, launch your Outlook application.
  2. Then, in the main Outlook window, get access to VBA editor with accordance to the article – “How to Run VBA Code in Your Outlook”.
  3. Next, enable “MS Word Object Library” and “MS PowerPoint Object Library” by referring to the article – “How to Add an Object Library Reference in VBA”.
  4. Next, copy and paste the following VBA code into a blank module.
Sub ExportEmailAsImage()
    Dim objMail As Outlook.MailItem
    Dim strFileName As String
    Dim strWordDocument As String
    Dim objWordApp As Word.Application
    Dim objWordDocument As Word.Document
    Dim objDocumentRange As Word.Range
    Dim objPowerPointApp As PowerPoint.Application
    Dim objPresentation As PowerPoint.Presentation
    Dim objShape As PowerPoint.Shape
 
    On Error Resume Next
    'Export the email as Word document
    Set objMail = Outlook.Application.ActiveExplorer.Selection(1)
    strFileName = Replace(objMail.Subject, "/", " ")
    strFileName = Replace(strFileName, "\", " ")
    strFileName = Replace(strFileName, ":", "")
    strFileName = Replace(strFileName, "?", " ")
    strFileName = Replace(strFileName, Chr(34), " ")
    strWordDocument = Environ("Temp") & "\" & strFileName & ".doc"
 
    objMail.SaveAs strWordDocument, olDoc

    Set objWordApp = CreateObject("Word.Application")
    Set objWordDocument = objWordApp.Documents.Open(strWordDocument)
    objWordApp.Visible = True
 
    objWordApp.Selection.Find.ClearFormatting
    objWordApp.Selection.Find.Replacement.ClearFormatting
 
    With objWordApp.Selection.Find
        .Text = "^p^p"
        .Replacement.Text = "^p"
        .Wrap = wdFindContinue
    End With
 
    'Insert the document into a PowerPoint Presentation slide as an object
    objWordApp.Selection.Find.Execute Replace:=wdReplaceAll
    Set objDocumentRange = objWordDocument.Range()
    objDocumentRange.Font.Name = "Calibri"
    objDocumentRange.Font.Size = 10
    objWordDocument.Close True
    objWordApp.Quit
 
    Set objPowerPointApp = CreateObject("PowerPoint.Application")
    Set objPresentation = objPowerPointApp.Presentations.Add
    objPowerPointApp.Visible = msoTrue
 
    With objPresentation
        .PageSetup.SlideHeight = 792
        .PageSetup.SlideWidth = 612
        .Slides.AddSlide 1, .SlideMaster.CustomLayouts(1)
    End With
 
    'Export the slide
    With objPresentation.Slides(1)
         Set objShape = .Shapes.AddOLEObject(0, 0, 612, 792, , strWordDocument)
        .Export "E:\Email_" & strFileName & ".jpg", "JPG"
    End With
 
    objPresentation.Saved = msoTrue
    objPresentation.Close
    objPowerPointApp.Quit
End Sub

VBA Code - Quickly Export an Outlook Email as an Image File

  1. After that, you need to add the macro to Quick Access Toolbar.
  2. Subsequently, you could close the VBA editor.
  3. Later, select an email and hit the macro button in Quick Access Toolbar.Run Macro through Quick Access Toolbar
  4. When macro completes, you can go to the predefined local folder to find the exported image file from this email.Exported Image File

Retrieve Outlook Data from Corrupted File

You may be quite frustrating if your Outlook file is subject to severe damage. In that scenario, you will proceed to extract Outlook data from the compromised file. Some users will tend to make use of the inbox repair tool. Yet, most of time, it will not make effects. Therefore, you had better keep a formidable and reliable PST fix tool, such as DataNumen Outlook Repair. It can scan the corrupt file and get back maximum data without any fusses.

Author Introduction:

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