2 Methods to Batch Change the Fonts of All Email Addresses in Your Outlook Email Body

So as to highlight all the email addresses in an email’s body, you may consider changing the fonts of the email addresses, such as showing them in italic red font. Now, this article will share you 2 effective and handy methods to get it.

Multiple users hope to quickly modify the fonts of all email addresses in an Outlook email body. This can be easily achieved by two means. One is making use of wildcards to find the email addresses and then replace their fonts, like Method 1 below. The other one is using regular expression in VBA code, whose steps are listed elaborately in the Method 2. Now, read on to get the two approaches.

Method 1: Use Wildcards in “Find and Replace”

  1. For a start, in the current email, press “Ctrl + H” key shortcut to display “Find and Replace” dialog box.
  2. Then, click “More>” button to show more options.
  3. Next, click into the “Find what:” box and check the “Use wildcards” option.
  4. Then, copy “[A-z,0-9]{1,}\@[A-z,0-9,.]{1,}” into the “Find what:” box.Find Email Addresses via Wildcards
  5. After that, click into the “Replace with:” box.
  6. Subsequently, click “Format” > “Font” in “Replace” label.Format Font in Replace
  7. Next, in the popup dialog box, specify the target font at will.Specify Font
  8. Later, click “OK”.
  9. Finally, click “Replace All” button.Replace All
  10. At once, the fonts of all email addresses in the current email will be changed.Formatted Email Addresses

Method 2: Use Regular Expression in VBA

  1. In the first place, keep the email opened.
  2. Then, trigger the VBA editor according to “How to Run VBA Code in Your Outlook“.
  3. Next, copy the code below into a module.
Sub ChangeFontOfAllEmailAddresses()
    Dim objInspector As Outlook.Inspector
    Dim objMailItem As Outlook.MailItem
    Dim objMailDocument As Word.Document
    Dim objRegExp As Object
    Dim objMatches As Object
    Dim objMatch As Object

    Set objInspector = Application.ActiveInspector
 
    If objInspector.CurrentItem.Class = olMail Then
       Set objMail = objInspector.CurrentItem
       Set objMailDocument = objMail.GetInspector.WordEditor
 
       'Find email addresses by regular expression
       Set objRegExp = CreateObject("vbscript.RegExp")
       With objRegExp
            .Pattern = "(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|""(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\[\x01-\x09\x0b\x0c\x0e-\x7f])*"")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])"
            .IgnoreCase = True
            .Global = True
       End With
 
      If objRegExp.Test(objMailDocument.Content) Then
         Set objMatches = objRegExp.Execute(objMailDocument.Content)
         'Change the font
         For Each objMatch In objMatches
             With objMailDocument.Content.Find
                  .ClearFormatting
                  .Text = objMatch.value
                  .Replacement.Text = objMatch.value
                  .Replacement.Font.Name = "Cambria"
                  .Replacement.Font.Italic = True
                  .Replacement.Font.ColorIndex = wdDarkRed
                  .Execute Replace:=wdReplaceAll
            End With
         Next
      End If
    End If
End Sub

VBA Code - Batch Change the Fonts of All Email Addresses in Email Body

Note: Change the font in the code to your liking.

  1. Later, press “F5” key to trigger this macro.
  2. After macro finishes, go back to the email, in which all email addresses have been shown in the specific font.Fonts of All Email Addresses Have Been Changed

Calm down Even in Case of Outlook Corruption

Everyone tends to be worried in all disasters, of course including data disasters. But, to be honest, panic will not be helpful but may lead to more chaotic situation. Hence, it is advisable to calm down as soon as possible even though you’re facing seriously damaged Outlook file. Only in this way, you can calmly solve this trouble effectively.

Author Introduction:

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

Comments are closed.