How to Auto Italicize All Non-alphanumeric Characters in Email Body with Outlook VBA

In order to distinguish non-alphanumeric characters from alphanumeric ones in an email’s body, you may be used to italicizing the non-alphanumeric characters. Now, in this post, we will share you a method to auto accomplish it.

Sometimes, when composing an email, you may input some non-alphanumeric characters in the email body, such as the characters in foreign language or the special symbols and so on. Usually, in order to make them shown differently from the alphanumeric characters, you may be used to italicizing them manually. Now, in the followings, we will introduce you a much more efficient method, which can let Outlook auto realize it.

Auto Italicize All Non-alphanumeric Characters in Email Body

  1. In the first place, launch Outlook program.
  2. Then, press “Alt + F11” to trigger Outlook VBA editor with reference to “How to Run VBA Code in Your Outlook“.
  3. Next, add reference to “MS Word Object Library” according to “How to Add an Object Library Reference in VBA“.
  4. Later, put the following code into the “ThisOutlookSession” project.
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim objMail As Outlook.MailItem
    Dim objMailDocument As Word.Document
    Dim objRegExp As Object
    Dim objMatches As Object
    Dim objMatch As Object
    If TypeOf Item Is MailItem Then
       Set objMail = Item
       Set objMailDocument = objMail.GetInspector.WordEditor
       'Find non-alphanumeric characters by Regular Expressions
       Set objRegExp = New RegExp
       With objRegExp
           .MultiLine = False
           .Global = True
           .IgnoreCase = True
           .Pattern = "[^a-zA-Z0-9]"
       End With
       If objRegExp.test(objMailDocument.Content) Then
          Set objMatches = objRegExp.Execute(objMailDocument.Content)
          For Each objMatch In objMatches
              With objMailDocument.Content.Find
                  .Text = objMatch.Value
                  .Replacement.Text = objMatch.Value
                  'Italicize the non-alphanumeric characters
                  .Replacement.Font.Italic = True
                  .Execute Replace:=wdReplaceAll
              End With
       End If
    End If
End Sub

VBA Code - Auto Italicize All Non-alphanumeric Characters in Email Body

  1. After that, exit the VBA code.
  2. Then, create and compose a new email which contains the non-alphanumeric characters in the body.
  3. Subsequently, click “Send” button.Send Email
  4. Finally, after the email is sent out, you can go to “Sent Items” folder to check it. You will find that all non-alphanumeric characters in the email have been italicized automatically.Auto Italicized Non-alphanumeric Characters in Email Body

Maintain Outlook Data in Good Status

It is admittedly an arduous task to safeguard Outlook data against corruption. So, if you are unwilling to encounter Outlook data loss, you have to make sufficient precautions, such as backing up Outlook file on a regular basis, being cautious of all potential risks and preparing a potent and reliable Outlook repair utility, like DataNumen Outlook Repair. With such a tool, even if Outlook data file becomes corrupted, you still can get back the data without breaking a sweat.

Author Introduction:

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

Comments are closed.