inserting a page break before a certain word in my doc

S

stabilo

I'm looking a way to go thru my document and insert a page break Before a
certain word :

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "MYWORD"
.Replacement.Text = "^m"
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub

This works but "MYWORD" is replaced obviously by the page break, but I want
to keep "MYWORD".
I'm receiving some 1000 pages of raw data and I need to insert page breaks
before a certain word that separate the records. Thnks
 
S

Stefan Blom

If you want to keep "MYWORD", simply change the .Replacement.Text line
to:

.Replacement.Text = "MYWORD^m"
 
H

Helmut Weber

Hi,

With Selection.Find
.Text = "MYWORD"
.Replacement.Text = "^mMYWORD"
.....

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
 

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