How to Display Message Excerpt in Email List via Outlook VBA

At times, you may want to view the beginning of an email without opening it simply in email list. This article will teach you how to quickly the first 50 characters of the message body and display the excerpt in a new column.

Outlook provides users with “Preview” feature, but it does not display message excerpt in a column. If you prefer to view message excerpt in a separate column, similar to the “Subject” columns alike, you can use the method introduced in this article. It will make use of VBA code and Outlook rule to add a “Excerpt” column and auto show the first 50 characters of the message body in this column.

Display Message Excerpt in Email List via Outlook VBA

Display Message Excerpt in Email List

  1. To start with, launch your Outlook program.
  2. Then in the Outlook window, press “Alt + F11” keys to access VBA editor.
  3. Next in the subsequent window, open a blank module.
  4. And then copy the following VBA code into this module window.
Sub AddExcerptColumn(objMail As Outlook.MailItem)
    Dim strExcerpt As String
    Dim objUserProperties As Outlook.UserProperties
    Dim objUserProperty As Outlook.UserProperty
    Dim strPropertyName As String
 
    'Get the first 50 characters of the message body
    strExcerpt = Left(objMail.Body, 50)
 
    strPropertyName = "Excerpt"
    Set objUserProperties = objMail.UserProperties
 
    'Check if there is already a field in this name
    Set objUserProperty = objUserProperties.Find(strPropertyName, True)
    If objUserProperty Is Nothing Then
       'If not, add this field
       Set objUserProperty = objUserProperties.Add(strPropertyName, olText, True)
    End If
 
    objUserProperty.value = strExcerpt
    objMail.Save
End Sub

VBA Code - Display Message Excerpt in Email List

  1. After that, you can exit the “Microsoft Visual Basic for Applications” window.
  2. Then you should create a new rule to run the new macro. Simply follow the steps below.
  • To start with, go to “File” menu and click “Manage Rules & Alerts” button.
  • In the new popup dialog box, hit “New Rule”.
  • And then select “Apply rule on messages I receive” and hit “Next” > “Next” to access “Actions” selection.
  • Next select “run a script” action and choose the previously added script – “AddExcerptColumn” and hit “Next”.Run the New Script
  • Subsequently, hit several “Next” until getting the final screen of “Rules Wizard”.
  • Lastly, name the new rule, such as “Display Excerpt” and enable the first two rule options and hit “Finish” button.Finish Rule Setup
  1. After that, the rule will start working on all existing emails in the Inbox.Run Rule on Existing Emails in Inbox
  2. After the new rule finishes running, you should back to the email list and add the new “Excerpt” column by the following steps:
  • Firstly, switch to “View” tab
  • And then hit “View Settings” button.
  • In the “Advanced View Settings” dialog box, click “Columns” button.
  • In the next dialog box, select “User-defined fields in Inbox”.
  • Next pitch on “Excerpt” column.
  • Later click “Add” button.
  • Ultimately, click a series of “OK” until all the dialog boxes are closed.Add Excerpt Column
  1. Eventually, you can back to the email list. You will see the “Excerpt” column, like the following screenshot:Excerpt Column in Email List

Rescue Corrupt PST in Time

As we all know, in the event of data corruption or loss, data recovery should be performed as soon as possible. Therefore, if your PST file proves inaccessible, you have to attempt PST recovery immediately. In this scenario, it demands you to get hold of a reputable and preeminent tool in advance, such as 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 mdf recovery and outlook repair software products. For more information visit www.datanumen.com

Comments are closed.