Emails which contain special characters tend to be blocked as spams. Hence, you should avoid special characters in outgoing emails’ subjects. Now, in this article, we will teach you to let Outlook auto remove special characters in email subject.
My previous article “How to Get Warned when Trying to Input Special Characters in Outlook Email Subject” has introduced a way to avoid special characters when composing email. But, some users wish Outlook to automatically remove special characters in subject when they click “Send” button to send out an email. Focused on this requirement, here we will expose another piece of VBA code. It can realize this with effortless ease.
Auto Remove Special Characters in Email Subject
- First off, launch Outlook program.
- Then, access VBA editor as per “How to Run VBA Code in Your Outlook“.
- Next, in VBA editor, enable “Microsoft VBScript Regular Expressions” with reference to “How to Add an Object Library Reference in VBA“.
- After that, put the following code into the “ThisOutlookSession” project.
'Occurs when sending an email Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) Dim objMail As Outlook.MailItem Dim objRegExp As RegExp Dim strSubject As String If TypeOf Item Is MailItem Then Set objMail = Item 'Get the mail subject strSubject = objMail.Subject 'Find special characters via regular expression Set objRegExp = New RegExp With objRegExp .MultiLine = False .Global = True .IgnoreCase = True .Pattern = "[^a-zA-Z0-9]" End With 'Replace special characters with space If objRegExp.test(strSubject) = True Then strSubject = objRegExp.Replace(strSubject, " ") objMail.Subject = strSubject End If End If End Sub
- Subsequently, close the VBA editor.
- Since then, every time when you try to send out an email whose subject has special characters, Outlook will automatically remove them, as shown in the following screenshot.
Keep Several Copies of Your Outlook Files
How do you deal with your Outlook in daily work? In reality, it’s highly suggested to keep several copies of your Outlook files. It aims to help you get rid of painful Outlook data loss. Just imagine the following scenario. For instance, your Outlook suddenly crashes and the opened files become inaccessible. In this case, if you’ve kept other copies, you don’t need to worry. Yet, if you don’t have, you’re required to fix Outlook and recover damaged Outlook data to your utmost. At this point, it demands you to take aid of a power tool, 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 sql recovery and outlook repair software products. For more information visit www.datanumen.com
Leave a Reply