View Single Post
 
Old 01-22-2023, 09:19 AM
AlanCantor AlanCantor is offline Windows 10 Office 2019
Competent Performer
 
Join Date: Nov 2020
Posts: 137
AlanCantor is on a distinguished road
Default

This will get you close:


Code:
Sub Remove012PhoneNumbers()
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "<012[0-9]{7}>"
        .Replacement.Text = "REMOVED"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        .MatchWildcards = True
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Reply With Quote