A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

School Reports



 
 
Thread Tools Display Modes
  #1  
Old May 2nd, 2005, 01:58 PM
CS
external usenet poster
 
Posts: n/a
Default School Reports

Hi - I am trying to mail merge some school reports from our Access Database.
We have two tables Grades (10 records per pupil) and Attendance (1 record
per pupil).

Firstly I merge the Grades table and then separately merge the attendance
table to create 2 word files.

What I would like to do is to take their attendance merge file and insert
single pages into the relevant place in their Grades merge, but I can't
think of any way to do it apart from after it has all printed, counting 10
pages then inserting the relevant cover sheet by hand and so on...

Anyone have any suggestions - I had a look at the splitter code and was
thinking if I could get it to split my main doc every ten pages or
something?

Thanks,

Colin


  #2  
Old May 2nd, 2005, 04:18 PM
Doug Robbins
external usenet poster
 
Posts: n/a
Default

It would be possible to use a modification of the splitter code to create a
new series of documents that was a combination of the output of the two
merges.

I am assuming here that the splitter code is the following:

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

Post back to the NG if you get stuck with the modifications.


--
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
"CS" wrote in message
...
Hi - I am trying to mail merge some school reports from our Access
Database. We have two tables Grades (10 records per pupil) and Attendance
(1 record per pupil).

Firstly I merge the Grades table and then separately merge the attendance
table to create 2 word files.

What I would like to do is to take their attendance merge file and insert
single pages into the relevant place in their Grades merge, but I can't
think of any way to do it apart from after it has all printed, counting 10
pages then inserting the relevant cover sheet by hand and so on...

Anyone have any suggestions - I had a look at the splitter code and was
thinking if I could get it to split my main doc every ten pages or
something?

Thanks,

Colin



  #3  
Old May 2nd, 2005, 06:46 PM
Bill
external usenet poster
 
Posts: n/a
Default

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!

Any other tips?

Thanks,

Colin

"Doug Robbins" wrote in message
...
It would be possible to use a modification of the splitter code to create
a new series of documents that was a combination of the output of the two
merges.

I am assuming here that the splitter code is the following:

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

Post back to the NG if you get stuck with the modifications.


--
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
"CS" wrote in message
...
Hi - I am trying to mail merge some school reports from our Access
Database. We have two tables Grades (10 records per pupil) and Attendance
(1 record per pupil).

Firstly I merge the Grades table and then separately merge the attendance
table to create 2 word files.

What I would like to do is to take their attendance merge file and insert
single pages into the relevant place in their Grades merge, but I can't
think of any way to do it apart from after it has all printed, counting
10 pages then inserting the relevant cover sheet by hand and so on...

Anyone have any suggestions - I had a look at the splitter code and was
thinking if I could get it to split my main doc every ten pages or
something?

Thanks,

Colin





  #4  
Old May 3rd, 2005, 08:36 AM
Doug Robbins
external usenet poster
 
Posts: n/a
Default

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


--
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
"Bill" wrote in message
...
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!

Any other tips?

Thanks,

Colin

"Doug Robbins" wrote in message
...
It would be possible to use a modification of the splitter code to create
a new series of documents that was a combination of the output of the two
merges.

I am assuming here that the splitter code is the following:

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

Post back to the NG if you get stuck with the modifications.


--
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
"CS" wrote in message
...
Hi - I am trying to mail merge some school reports from our Access
Database. We have two tables Grades (10 records per pupil) and
Attendance (1 record per pupil).

Firstly I merge the Grades table and then separately merge the
attendance table to create 2 word files.

What I would like to do is to take their attendance merge file and
insert single pages into the relevant place in their Grades merge, but I
can't think of any way to do it apart from after it has all printed,
counting 10 pages then inserting the relevant cover sheet by hand and so
on...

Anyone have any suggestions - I had a look at the splitter code and was
thinking if I could get it to split my main doc every ten pages or
something?

Thanks,

Colin







  #5  
Old May 3rd, 2005, 10:31 PM
Colin
external usenet poster
 
Posts: n/a
Default

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

"Doug Robbins" wrote in message
...
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


--
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
"Bill" wrote in message
...
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!

Any other tips?

Thanks,

Colin

"Doug Robbins" wrote in message
...
It would be possible to use a modification of the splitter code to
create a new series of documents that was a combination of the output of
the two merges.

I am assuming here that the splitter code is the following:

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

Post back to the NG if you get stuck with the modifications.


--
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
"CS" wrote in message
...
Hi - I am trying to mail merge some school reports from our Access
Database. We have two tables Grades (10 records per pupil) and
Attendance (1 record per pupil).

Firstly I merge the Grades table and then separately merge the
attendance table to create 2 word files.

What I would like to do is to take their attendance merge file and
insert single pages into the relevant place in their Grades merge, but
I can't think of any way to do it apart from after it has all printed,
counting 10 pages then inserting the relevant cover sheet by hand and
so on...

Anyone have any suggestions - I had a look at the splitter code and was
thinking if I could get it to split my main doc every ten pages or
something?

Thanks,

Colin









  #6  
Old May 4th, 2005, 07:20 AM
Doug Robbins
external usenet poster
 
Posts: n/a
Default

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

--
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
"Colin" wrote in message
...
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

"Doug Robbins" wrote in message
...
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


--
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
"Bill" wrote in message
...
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!

Any other tips?

Thanks,

Colin

"Doug Robbins" wrote in message
...
It would be possible to use a modification of the splitter code to
create a new series of documents that was a combination of the output
of the two merges.

I am assuming here that the splitter code is the following:

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

Post back to the NG if you get stuck with the modifications.


--
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
"CS" wrote in message
...
Hi - I am trying to mail merge some school reports from our Access
Database. We have two tables Grades (10 records per pupil) and
Attendance (1 record per pupil).

Firstly I merge the Grades table and then separately merge the
attendance table to create 2 word files.

What I would like to do is to take their attendance merge file and
insert single pages into the relevant place in their Grades merge, but
I can't think of any way to do it apart from after it has all printed,
counting 10 pages then inserting the relevant cover sheet by hand and
so on...

Anyone have any suggestions - I had a look at the splitter code and
was thinking if I could get it to split my main doc every ten pages or
something?

Thanks,

Colin











 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Access to Output Crystal Reports Gummy Setting Up & Running Reports 0 April 15th, 2005 05:34 PM
Blank Pages at the beginning of Parent Report with 5 child or sub reports Cyndy Sheehan Setting Up & Running Reports 1 March 4th, 2005 10:36 PM
Is there something wrong with this? Kath Running & Setting Up Queries 2 October 6th, 2004 02:41 PM
Shifting Weeks for Quarterly Reports setoFairfax General Discussion 1 September 8th, 2004 05:43 PM
Need help w/ reports Tom Setting Up & Running Reports 0 June 25th, 2004 05:59 PM


All times are GMT +1. The time now is 05:50 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.