A family of Microsoft word processing software products for creating web, email, and print documents.
Hi,
I'm Tim, an Independent Consultant here and a Microsoft user like you. I don't work for Microsoft and do not have access to any of your data on their system.
It seems that the macro you are trying to run has an issue with the Find What text, specifically with the pattern match expression. The expression provided seems to have some syntax errors. To fix it, you need to correct the regular expression. Here's the updated expression:-
Sub Test
Application.ScreenUpdating = False
Do
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
. Text = "[A-Z][a-z]{1,3} [A-Z][a-z]{1,} [A-Z][a-z]{1,31}"
. Replacement.Text = " "
. Forward = True
. Wrap = wdFindStop
. Format = True
. MatchCase = False
. MatchWholeWord = False
. MatchWildcards = True
. MatchSoundsLike = False
. MatchAllWordForms = False
End With
Selection.Find.Execute
If Selection.Find.Found Then
With Selection.Font
. Bold = True
. Color = wdColorRed
End With
Selection.EscapeKey
Selection.MoveDown Unit:=wdLine, Count:=2
Selection.HomeKey Unit:=wdLine
End If
Loop While Selection.Find.Found
Application.ScreenUpdating = True
End Sub
Now the macro should function properly, and it will find and format the specified pattern in your document.
I hope this information helps. If you have any questions, please let me know and I'll be glad to assist you further or If you find it helpful, you can mark this comment as the answer.
Kind regards
Tim