How to Auto Remove All Extra Spaces between Words in Your Outlook Email

If you often type extra spaces accidentally when composing Outlook email, you may wish to make Outlook auto remove all extra spaces between words. Now, this article will teach you a convenient method to realize it.

At times, when you compose an email, you may input many extra spaces between words by mistake. They will make the email contents messy. At this point, you’ll hope to remove all these extra spaces. To manually accomplish it, you can utilize “Find & Replace” feature to replace all “([ ])[ ]{1,}” with “\1” with wildcards. But, in comparison, it would be much more convenient and effective if Outlook is able to auto do this. Now, in the followings, we’ll introduce you a method to configure your Outlook.

Find & Replace Using Wildcards

Auto Remove All Extra Spaces between Words in Email

  1. First off, access VBA editor via pressing “Alt + F11” in Outlook.

Note: If you’re totally a new in VBA, you can refer to my previous article “How to Run VBA Code in Your Outlook” at the same time.

  1. Then, add “MS Word Object Library” according to “How to Add an Object Library Reference in VBA“.
  2. Next, put the VBA 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
 
    'Get current mail
    If TypeOf Item Is MailItem Then
       Set objMail = Item
       Set objMailDocument = objMail.GetInspector.WordEditor
 
       'Remove all extra spaces using wildcards
       With objMailDocument.Range.Find
            .ClearFormatting
            .Replacement.ClearFormatting
            .Text = "([ ])[ ]{1,}"
            .Replacement.Text = "\1"
            .Forward = True
            .MatchWildcards = True
            .Execute Replace:=wdReplaceAll
      End With
    End If
End Sub

VBA Code- Auto Remove All Extra Spaces between Words in Email

  1. Afterwards, exit the current window.
  2. Finally, follow the steps below to have a try.
  • To start with, create and compose an email. Here you can intentionally type several extra spaces between words, like the following figure.Compose an Email with Extra Spaces between Words
  • After filling in the recipients, directly click “Send” button to send it out.
  • Finally, when it’s sent, go to “Sent Items” folder to find it. You can see that all the extra spaces have been removed automatically.All Extra Spaces between Words Have Been Removed

Don’t Be Afraid of Outlook File Corruption

In the event of Outlook crash, users will get panic and fear that their Outlook files will be corrupt. In fact, as long as you make some effective precautions, you could get rid of such concerns easily. First of all, you ought to persist in regularly back up your PST files, which plays a greatly important role in data protection. Also, it is advisable to prepare a credible and potent external Outlook repair tool, such as DataNumen Outlook Repair, as inbox repair tool is admittedly unable to fix PST that is compromised severely.

Author Introduction:

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

Leave a Reply

Your email address will not be published. Required fields are marked *