View Single Post
 
Old 04-08-2018, 11:46 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

You can do that with a single search and replace. If it needs to be a macro, recording that and doing a quick tidy gives you this macro.
Code:
Sub Macro2()
  Options.DefaultHighlightColorIndex = wdBrightGreen
  With Selection.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Replacement.Highlight = True
    .Text = "PQC70([1-5])"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchCase = False
    .MatchWholeWord = True
    .MatchAllWordForms = False
    .MatchSoundsLike = False
    .MatchWildcards = True
    .Execute Replace:=wdReplaceAll
  End With
End Sub
Refer to the attached graphic to see what the search and replace dialog would look like. Note: I decided to remove the replacewith text and also check the Whole Word setting after capturing the screen shot but the result is essentially the same.
Attached Images
File Type: png Capture.PNG (14.3 KB, 29 views)
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote