I haven't tested this, but if you save the document created by merging with
the information on Grades as a file name Grades, and that created by merging
with the information on Attendances as a file named Attendance, both of them
in the default document folder, and then run the following version of the
macro when both of those documents are closed, it should open them up and
create a series of letters (Letter1, Letter21, Letter31 etc) each of which
will contain the 10 Grades pagess for the student, followed by the
Attendance page. Of course the order of the students in the merge datafiles
will need to be the same to ensure that the correct Attendance page goes
with each set of Grades pages.
Dim i As Long, Grades As Document, Attendance As Document, Target As
Document, Letter As Range
Set Grades = Documents.Open("Grades.doc")
Set Attendance = Documents.Open("Attendance.doc")
For i = 1 To Grades.Sections.Count Step 10
Set Letter = Grades.Sections(i).Range
Letter.End = Grades.Sections(10).Range.End - 1
Set Target = Documents.Add
Target.Range = Letter
Set Letter = Attendance.Sections.First.Range
Letter.End = Letter.End - 1
Target.Range.InsertAfter Letter
Attendance.Sections.First.Range.Delete
Target.SaveAs FileName:="Letter" & i
Target.Close
Next i

Signature
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
> To be honest I have never used macros in word! I tried incrementing the i
> by 10 each time but wasn't all that successful!
[quoted text clipped - 53 lines]
>>>
>>> Colin
Colin - 03 May 2005 22:31 GMT
Thanks for giving it a go! But it seems to mess the formatting around quite
a bit as I have used tables to merge data into and the copying and pasting
bit of the code seems to leave out the formatting...
What does letter do in the code - is letter a page?
Thanks,
Colin
>I haven't tested this, but if you save the document created by merging with
>the information on Grades as a file name Grades, and that created by
[quoted text clipped - 81 lines]
>>>>
>>>> Colin
Doug Robbins - 04 May 2005 07:20 GMT
Try the following modification that makes use of the .FormattedText property
of a range (which is what Letter is defined as)
' splitter Macro
' Macro created by Doug Robbins to save each letter created by a mailmerge
as a separate file.
Dim i As Long, Grades As Document, Attendance As Document, Target As
Document, Letter As Range
Set Grades = Documents.Open("Grades.doc")
Set Attendance = Documents.Open("Attendance.doc")
For i = 1 To Grades.Sections.Count Step 10
Set Letter = Grades.Sections(i).Range.FormattedText
Letter.End = Grades.Sections(10).Range.End - 1
Set Target = Documents.Add
Target.Range.FormattedText = Letter
Set Letter = Attendance.Sections.First.Range
Letter.End = Letter.End - 1
Target.Range.InsertAfter Letter
Attendance.Sections.First.Range.Delete
Target.SaveAs FileName:="Letter" & i
Target.Close
Next i
End Sub

Signature
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
> Thanks for giving it a go! But it seems to mess the formatting around
> quite a bit as I have used tables to merge data into and the copying and
[quoted text clipped - 91 lines]
>>>>>
>>>>> Colin