Splitting document on hard page break

J

Jack

I've seen in several posts how to split each page in a document into a
separate document. And I've seen how to search / replace hard page breaks.
What I can't figure out is how to combine them and do the following -

Take the pages between each hard page break and save them into separate
documents.

The logic should be simple - start a range, go to the next hard page break,
end the range, copy the range, throw it to a new document and save it. But
nailing the ranges by hard page break is killing me.

Thanks in advance.
 
C

Charles Kenyon

Hard page breaks are an anathema. Avoid them if at all possible. Can you use
page-break-before paragraph formatting or next-page section breaks instead?
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
J

Jack

You lost me there - are you referring to detecting page breaks or existing
page breaks in the document? The document has ~30 pages, most of them
having a [ctrl]+[enter] (hard page break) after a paragraph or two. Some
paragraphs are extremely long and run over to multiple pages. I need to
parse through each of the [ctrl]+[enter] and put any pages between them to a
separate document.
 
C

Charles Kenyon

I'm referring to hard page breaks. They exist inside paragraphs, which is
where you run into problems, or at least one part of where you run into
problems. You have to work with what you have, just letting you know. Word
just isn't set up to deal with pages as units until print time. I would
suggest trying (on a copy) replacing the hard page breaks with next-page
section breaks and then working with some of the code you've seen.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.


Jack said:
You lost me there - are you referring to detecting page breaks or existing
page breaks in the document? The document has ~30 pages, most of them
having a [ctrl]+[enter] (hard page break) after a paragraph or two. Some
paragraphs are extremely long and run over to multiple pages. I need to
parse through each of the [ctrl]+[enter] and put any pages between them to
a separate document.


Charles Kenyon said:
Hard page breaks are an anathema. Avoid them if at all possible. Can you
use page-break-before paragraph formatting or next-page section breaks
instead?
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
D

Doug Robbins - Word MVP

You should be able to use Find and Replace to replace the hard page breaks
with Section Breaks and then use the following macro:

Dim i As Long, Source as Document, Target as Document, Letter as Range
Set Source = ActiveDocument
For i = 1 to Source.Sections.Count
Set Letter = Source.Sections(i).Range
Letter.End=Letter.End-1
Set Target = Documents.Add
Target.Range=Letter
Target.SaveAs FileName:="Letter" & i
Target.Close
Next i


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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