Search and replace a whole paragraph!

M

michaelharringt

SEARCH AND REPLACE A WHOLE PARAGRAPH

I would like to search for a word in a document e.g [p1] and replace
it with a whole paragraph or more but the replace box is limited to a
small number of characters

Is there another way I can do this?

Many thanks

Michael
 
G

Graham Mayor

Copy the paragraph to the clipboard then replace [p1] with ^c

--
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
Graham Mayor - Word MVP
E-mail (e-mail address removed)
Web site www.gmayor.com
Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
 
L

Larry

Here's what I would suggest.

First, create an AutoText entry containing the paragraph of text that
you want to use as a replacement. To create the entry, type the text in
a document, then select it, then press Alt+F3 and type in the name you
want to use for the AutoText entry. Let's say the name you choose is
test.

Next, create a macro that will search for the word you want to replace,
which in this case is world, and replace it with the autotext entry,
named test. The below macro does the job:

Application.ScreenUpdating = False
With Selection.Find
.ClearFormatting
.Text = "world"
.Forward = True
.Wrap = wdFindContinue

Do While .Execute
NormalTemplate.AutoTextEntries("test").Insert Where:=Selection.Range,
RichText:=True
Loop
End With

Larry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top