saving a multi page document into smaller documents

E

ECOS

Hello,
I know this question has been asked before, but I cannot seem to figure out
if there is an answer.
In general I have a 50 page document (a merge document) that I need to save
into 10 5 page documents. The merge document contains a 5 page form that I
need as an individual doc to work with later.
I have used some of the code posted here and the best I can do is save each
single page. (ex. ActiveDocument.Bookmarks("\Page").Range.Cut) is there a way
to to make a range or selection object that contains multiple pages? DO i
have to put info into the merge document that tells the macro where to split
it?
Any info would be of great help.
PS - I am a novice programmer, so please explain any programming details.
Thank You,
MH
 
D

Doug Robbins

If each group of 5 pages are the result of merging one record from the
datasource, there will be a section break separating each of the groups of 5
pages. If that is the case, the following macro will do what you want:

Sub splitter()

' splitter Macro

' Macro created by Doug Robbins to save each letter created by a mailmerge
as a separate file.

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

End Sub


--
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
 
Top