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”
- For a start, in the current email, press “Ctrl + H” key shortcut to display “Find and Replace” dialog box.
- Then, click “More>” button to show more options.
- Next, click into the “Find what:” box and check the “Use wildcards” option.
- Then, copy “[A-z,0-9]{1,}\@[A-z,0-9,.]{1,}” into the “Find what:” box.
- After that, click into the “Replace with:” box.
- Subsequently, click “Format” > “Font” in “Replace” label.
- Next, in the popup dialog box, specify the target font at will.
- Later, click “OK”.
- Finally, click “Replace All” button.
- At once, the fonts of all email addresses in the current email will be changed.
Method 2: Use Regular Expression in VBA
- In the first place, keep the email opened.
- Then, trigger the VBA editor according to “How to Run VBA Code in Your Outlook“.
- 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
Note: Change the font in the code to your liking.
- Later, press “F5” key to trigger this macro.
- After macro finishes, go back to the email, in which all email addresses have been shown in the specific font.
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
Leave a Reply