View Single Post
 
Old 06-24-2015, 12:02 PM
spc94 spc94 is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Jun 2015
Location: Ohio, USA
Posts: 8
spc94 is on a distinguished road
Default Finding and Replacing a word with text copied to clip board

I am trying to find a specific word and replace with text copied to my clip board. Currently I am searching the word replacing it with nothing and then pasting it there but it does seem to work correctly any suggestions.

ChangeFileOpenDirectory "X:\sconner\CCD Damage Mechanisms\Mechanisms\"
Documents.Open FileName:= _
"X:\sconner\CCD Damage Mechanisms\Mechanisms\Underdeposit Corrosion.docx", _
ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _
wdOpenFormatAuto, XMLTransform:=""
Selection.WholeStory
Selection.Copy
ActiveWindow.Close
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "(NEXT MECH)"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.PasteAndFormat (wdUseDestinationStylesRecovery)
Reply With Quote