Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 05-03-2017, 06:04 AM
gmaxey gmaxey is offline Find & Replace Unique word Windows 7 32bit Find & Replace Unique word Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,636
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Your code doesn't compile so I don't see how it is finding or not finding anything.

Find whole word is disabled when certain characters are included in the find string. You could do this in steps (just make sure your document is not a thesis on the behavior of the Aardvark):

Code:
Sub InSteps()
Dim oRng As Range
  Set oRng = ActiveDocument.Range
  With oRng.Find
    .Text = "^^"
    .Replacement.Text = "Aardvark"
    .Execute Replace:=wdReplaceAll
    Set oRng = ActiveDocument.Range
    .Text = "Aardvarkmb"
    .Replacement.Text = "Test"
    .MatchWholeWord = True
    .Execute Replace:=wdReplaceAll
    Set oRng = ActiveDocument.Range
    .Text = "Aardvark"
    .Replacement.Text = "^^"
    .MatchWholeWord = False
    .Execute Replace:=wdReplaceAll
  End With
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find & Replace Unique word MS Word 2016 Find and Replace BillM Word 2 03-14-2017 10:49 AM
Find & Replace Unique word Need help using Find & Replace (MS Word) BZee Word 9 02-16-2015 05:45 PM
Replace each heading with a unique numeric value amitkapoor Word 7 05-06-2013 03:29 AM
Find & Replace Unique word Word Find and Replace Query bthart Word 1 12-29-2011 12:45 AM
Find & Replace Unique word Bad view when using Find and Find & Replace - Word places found string on top line paulkaye Word 4 12-06-2011 11:05 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:15 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft