Change all dates in a document from MMMM DD, YYYY to DD MMMM YYYY

Article contributed by Bill Coan

Create a macro based on Word's wildcard search-and-replace capabilities. Target only those month names that are followed by a one or two-digit day and then a comma. In other words, change the format of a date like January 12, 1904 but do nothing to a date like January 1904.

Notes
Use text similar to the following for find what and replace with:
Find What: "(January) ([0-9]{1,2}),"
Replace With "\2 \1"

The text above is specific, of course, to the month of January. Here's how Word interprets the Find What text and Replace With text:

Find What
Find the word January followed by a space followed by one or two occurrences of a digit from 0-9, followed by a comma. January occurs within parentheses so that it can be reused in the Replace With text. Likewise, the expression that specifies one or two occurrences of a digit from 0-9 also occurs within parentheses so that it fcan be reused in the Replace With text. The space after January and the comma after the one-or-two-digit expression do NOT occur within parentheses, because we don't need to reuse them in the Replace With text.

Replace With
In place of the found text, insert the one-or-two-digit expression followed by a space followed by the word January. (No space is needed after the word January, because a space already follows the found text.)

Sub ChangeDateFormatWithReplaceCommand()

Dim myMonth(1 To 12) As String

myMonth(1) = "January"
myMonth(2) = "February"
myMonth(3) = "March"
myMonth(4) = "April"
myMonth(5) = "May"
myMonth(6) = "June"
myMonth(7) = "July"
myMonth(8) = "August"
myMonth(9) = "September"
myMonth(10) = "October"
myMonth(11) = "November"
myMonth(12) = "December"

For i = 1 To 12
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "(" & myMonth(i) & ")" & " ([0-9]{1,2}),"
        .Replacement.Text = "\2 \1"
        .Forward = True
        .Wrap = wdFindAsk
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = True
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
Next i

End Sub