i want to be able to replace all values of wordA with wordB but only within a
certain area of the word document. how is this done?
Graham Mayor - 03 Aug 2005 08:52 GMT
Select the text before running the replace tool and don't replace in the
rest of the document when prompted.

Signature
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> i want to be able to replace all values of wordA with wordB but only
> within a certain area of the word document. how is this done?
Helmut Weber - 03 Aug 2005 08:56 GMT
Hi,
like this:
Sub test8888()
Dim rPrg As Range
Set rPrg = ActiveDocument.Paragraphs(2).Range ' e.g.
ResetSearch
With rPrg.Find
.Text = "o"
.Replacement.Text = "x"
.Wrap = wdFindStop
.Execute Replace:=wdReplaceAll
End With
ResetSearch
End Sub
Public Sub ResetSearch()
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
End Sub
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000