How to Batch Change the Formats of All Dates in Your Outlook Email

If you want to batch change the formats of all dates in an email, such as altering dates from short date format to long date format, you can use the way introduced in this article.

When you compose an email, if you would like to change the original formats of all dates, like modifying them from short date format to long date format, such as changing “12/7/2017” to “December 7, 2017”, you must long for a quicker means. It allows you to accomplish the changes in one go. Now, in the followings, we will teach you such a method.

Batch Change the Formats of All Dates in Your Outlook Email

Batch Change the Formats of All Dates in Email

  1. In the first place, launch your Outlook program.
  2. Next, in the main Outlook window, press “Alt + F11” buttons.
  3. Then you’ll enter “Microsoft Visual Basic for Applications” window, in which you need to access a module that is not in use.
  4. Subsequently, you could copy and paste the following VBA code into it.
Sub BatchChangeFormatsOfAllExistingDates()
    Dim objCurrentMail As Outlook.MailItem
    Dim objMailDocument As Word.Document
    Dim objWordApp As Word.Application
    Dim objWordSelection As Word.Selection
    Dim bFound As Boolean

    Set objCurrentMail = Application.ActiveInspector.CurrentItem
    Set objMailDocument = objCurrentMail.GetInspector.WordEditor
    Set objWordApp = objMailDocument.Application
    Set objWordSelection = objWordApp.Selection
 
    bFound = True

    While bFound = True
          With objWordSelection.Find
               .ClearFormatting
               .Replacement.ClearFormatting
               'Format is "mm/dd/yyyy"
               .Text = "([0-9]{1,2})[/]([0-9]{1,2})[/]([0-9]{4})"
               'If format is "mm-dd-yyyy", use the following line instead
               '.Text = "([0-9]{1,2})[-]([0-9]{1,2})[-]([0-9]{4})"
               .Wrap = wdFindContinue
               .Format = True
               .Forward = True
               .MatchWildcards = True
         End With

         objWordSelection.Find.Execute Replace:=wdReplaceNone

         If IsDate(objWordSelection.Text) Then
            'Change the found date to long date format
            objWordSelection.Text = Format(objWordSelection.Text, "mmmm d, yyyy")
            objWordSelection.Collapse wdCollapseEnd
         Else
            bFound = False
         End If
    Wend
End Sub

VBA Code - Batch Change the Formats of All Dates

  1. After that, you can close this window as usual.
  2. Later, for future convenience, you had better add this macro to Quick Access Toolbar of Message window.
  3. Finally, you could take a shot:
  • To start with, compose an email which contains many dates in short date format,
  • Then, click on the macro button in Quick Access Toolbar.
  • After the macro finishes, you’ll find that all the dates have been changed into long date format.

Protect Your Outlook against Various Hazards

Without a doubt, no one is willing to accept Outlook corruption. Therefore, some precautions should be in place ahead of time, including making regular PST data backups, keeping cautions of potential viruses and preparing a powerful Outlook repair tool, like DataNumen Outlook Repair. Such a tool will surely come in handy when both backups and inbox repair tool fail to recover PST data.

Author Introduction:

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

Comments are closed.