Remove all page break and rearrange

  • Thread starter NEL:Remove all page break and rearrange
  • Start date
N

NEL:Remove all page break and rearrange

Dear All,
I have some hugh word documents. I want to remove all the page breaks of
the whole document and add the page break based on some criteria.
Can VBA achieve it?
Thanks in advance
 
H

Helmut Weber

Hi,

if the pagebreaks were inserted by hand or by code
they can be removed.
based on some criteria.

Very probably.

If a criterion would be your blood pressure
at a given time, it would need some preparations. ;-)

You got to tell us more.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
N

NEL:Remove all page break and rearrange

Hi,
Thanks for your reply.
Actually the situation is like :
I need to remove all the page break of the whole document.
And then, I will search a keyword like the company name and add a page break
before the company name.
Is it possible?

Thanks
 
H

Helmut Weber

Hi,

like this,
if the pagebreaks are simple manual pagebreaks (^m),
not sectionbreaks (^b) of type new page.
Then it would not be quite that simple.

Sub Macro9AA()
Dim rngDcm As Range
Set rngDcm = ActiveDocument.Range
With rngDcm.Find
.Text = "^m"
.Replacement.Text = ""
.Execute Replace:=wdReplaceAll
.Text = "Company"
.Replacement.Text = "^mCompany"
.Execute Replace:=wdReplaceAll
End With
End Sub

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

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