Thread: [Solved] Find & Replace Unique word
View Single Post
 
Old 05-06-2017, 06:29 AM
gmaxey gmaxey is offline Windows 7 32bit Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

As I have already taken pains to express, the find whole word option is disregarded when using symbols and such in the find string. You have to do it in steps:

Code:
Sub InSteps()
Dim oRng As Range
  Set oRng = ActiveDocument.Range
  With oRng.Find
    .Text = "Ë_do"
    .Replacement.Text = "Aardvark"
    .Execute Replace:=wdReplaceAll
    Set oRng = ActiveDocument.Range
    .Text = "Aardvark"
    .Replacement.Text = "Whatever you want to replace with"
    .MatchWholeWord = True
    .Execute Replace:=wdReplaceAll
    Set oRng = ActiveDocument.Range
    .Text = "Aardvark"
    .Replacement.Text = "Ë_do"
    .MatchWholeWord = False
    .Execute Replace:=wdReplaceAll
  End With
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/