How to Batch Extract the Texts of All Tables in an Outlook Email

It is easy to convert a table to text, extracting the texts of a table. However, if you want to extract the texts of all tables in one go, you can use the way introduced in this post.

In my previous article “How to Convert Between Text and Table in Outlook Messages”, you can learn the standard way to convert a table to text. There is no denying that it is simple. Nevertheless, if a mail contains multiple tables and you wish to convert all of them to text, using that way is a bit troublesome in that you have to do that one by one manually. Hence, in the followings, we will introduce a more effective and convenient way to you.

Batch Extract the Texts of All Tables in an Outlook Email

Batch Extract the Texts of All Tables

  1. At the very beginning, launch your Outlook application.
  2. Then, get access to Outlook VBA editor with accordance to my previous post – “How to Run VBA Code in Your Outlook”.
  3. In this new window, you need to activate “Ms Word 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 module which isn’t being used.
Sub BatchConvertAllTablesToText()
    Dim objMail As Outlook.MailItem
    Dim objMailDocument As Word.Document
    Dim objTables As Word.Tables
    Dim objTable As Word.Table
 
    'Get the currently opened email
    Set objMail = Outlook.Application.ActiveInspector.CurrentItem
    Set objMailDocument = objMail.GetInspector.WordEditor
 
    'Get all the tables of the current email
    Set objTables = objMailDocument.Tables
 
    'Convert all tables to text
    For Each objTable In objTables
        objTable.ConvertToText Separator:=wdSeparateByTabs
    Next
End Sub

VBA Code -Batch Extract the Texts of All Tables

  1. Subsequently, you can exit the current window.
  2. Next, open the source email whose tables you want to convert to text.
  3. Subsequently, click the down arrow in the Quick Access Toolbar and choose “Commands” from the drop down list.
  4. After that, in the new window, add the new macro to Quick Access Toolbar of Message window.
  5. Later, after returning to the source email, you should turn it into an editable mode. Click “Actions” > “Edit Message”.Edit Message
  6. Lastly, click the newly added macro button in Quick Access Toolbar.
  7. When macro completes, you’ll see that all the tables have been converted to text, like the following screenshot:Extracted Text from All Tables in the Email

Retrieve Compromised Outlook Files

Compared with other email clients, Outlook provides us with many possibilities, including email communication, social network updates, managing appointments and tasks, etc. However, it is frustrating that Outlook is still susceptible to errors and corruption. Once your Outlook file is corrupted seriously, the best situation is that you have an effective and up-to-date data backup. But if not, your last resort is a handy and reliable PST recovery tool, 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 recover Sql Server and outlook repair software products. For more information visit www.datanumen.com

Comments are closed.