How to Quickly Export All Tables in an Outlook Email as Pictures

Some users would like to extract the tables in an email and save them as pictures in a Windows folder. Obviously, Outlook doesn’t have such a function. But it still can be realized by means of VBA code. This article will show the details.

If you want to extract the tables of an Outlook email and recycle them, you could export and store them as pictures on a local drive. Yet, there is not such a native function in Outlook. Therefore, if you want to achieve it, you can use the following way, which is making use of VBA code.

Quickly Export All Tables in an Outlook Email as Pictures

Export All Tables in an Email as Pictures

  1. For a start, launch your Outlook program.
  2. Then, in Outlook, access VBA editor with reference to the post – “How to Run VBA Code in Your Outlook”.
  3. Subsequently, you need to enable “MS Excel Object Library” as well as “Ms Word Object Library”, which you can refer to the article – “How to Add an Object Library Reference in VBA“.
  4. Next, put the following VBA code into an unused project or module.
Sub ExportTablesAsPictures()
    Dim objMail As Outlook.MailItem
    Dim objMailDocument As Word.Document
    Dim objTable As Word.Table
    Dim objExcelApp As Excel.Application
    Dim objExcelWorkbook As Excel.Workbook
    Dim objExcelWorksheet As Excel.Worksheet
    Dim i As Long
    'Create a new excel workbook
    Set objExcelApp = CreateObject("Excel.Application")
    Set objExcelWorkbook = objExcelApp.Workbooks.Add
    objExcelApp.Visible = True
    'Get the tables in the selected email
    Set objMail = Outlook.Application.ActiveExplorer.Selection.Item(1)
    Set objMailDocument = objMail.GetInspector.WordEditor
    'Copy all tables into separate worksheets
    For i = 1 To objMailDocument.Tables.Count
        Set objTable = objMailDocument.Tables(i)
        Set objExcelWorksheet = objExcelWorkbook.Sheets(i)
        Call ExportAsImage(objExcelWorksheet, i)
    objExcelWorkbook.Close False
End Sub

Sub ExportAsImage(ByVal objSheet As Excel.Worksheet, ByRef n As Long)
    Dim objRange 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 table
    Set objRange = objSheet.UsedRange
    'Export the table as JPG image
    strImageFile = "E:\Table " & n & ".jpg"
    With objSheet.ChartObjects.Add(objRange.Left, objRange.Top, objRange.Width, objRange.Height)
        .Chart.Export strImageFile, "JPG"
    End With
End Sub

VBA Code - Export All Tables in an Email as Pictures

  1. After that, you can add this macro to Quick Access Toolbar.
  2. Later, you can try this macro.
  • First off, select an email.
  • Then, click the macro button in Quick Access Toolbar.Run Macro from Quick Access Toolbar
  • When the macro finishes, go to the predefined Windows folder, in which you will see the exported tables in JPG format.Exported Table Images

Back up Outlook Data at Regular Intervals

Although Outlook earns a lot of kudos, it is still unable to get immune from errors and damage. Therefore, in order to block valuable Outlook data from loss, you’d better back up Outlook data regularly, such that even if Outlook data gets corrupt, you still can restore it from backups. Yet, if the backups prove failure, you have no choice but to resort to a robust enough Outlook recovery utility, like DataNumen Outlook Repair.

Author Introduction:

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

Comments are closed.