Merge file printing problem

F

Frank P Florida

I have a 7 mb. word document(many graphics) that I am trying to personalize
by using a mail merge. I am prinint 135 unique documents by doing a mail
merge with excel. I am only merging in 2 small fields but it takes a
tremendously long time to do this job. When I started the merge the first
30-40 documents were created quickly then it slowed to a crawl and took a
couple of hours to finish the other 100. It appears it must be some kind of
memopry issue or something. Is there some way to set this up so that I don't
get bogged down beacuse my document is so large?

Thanks for any ideas.
 
P

Peter Jamieson

When Word does a Mail Merge to printer, all the output is in a single Print
Job. 7Mb x 135 is approaching 1Gb which is quite a lot of /extra/ RAM even
by today's standards, and there is probably loads of extra overhead for
reasons I don't even want to think about!

One thing you can try in the simple case is to use VBA to do one merge per
record in the data source using a macro such as the following:

Sub PrintOneDocPerSourceRec()
Dim intSourceRecord
Dim objMerge As Word.MailMerge
'Dim strOutputDocumentName As String
Dim TerminateMerge As Boolean

' Need to set up this object as the ActiveDocument changes when the
' merge is performed. Besides, it's clearer.

Set objMerge = ActiveDocument.MailMerge
With objMerge

' If no data source has been defined, do it here using OpenDataSource.
' But if it is already defined in the document, you should not need
' to define it here.

' .OpenDataSource _
' Name:="whatever"

intSourceRecord = 1
TerminateMerge = False

Do Until TerminateMerge
.DataSource.ActiveRecord = intSourceRecord

' if we have gone past the end (and possibly, if there are no records)
' then the Activerecord will not be what we have just tried to set it to

If .DataSource.ActiveRecord <> intSourceRecord Then
TerminateMerge = True
' the record exists
Else

.DataSource.FirstRecord = intSourceRecord
.DataSource.LastRecord = intSourceRecord
.Destination = wdSendToPrinter
.Execute

intSourceRecord = intSourceRecord + 1
End If
Loop
End With
End Sub

You may also find the follwong useful:
http://word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm
http://word.mvps.org/FAQs/MailMerge/MergeStraightToPrintrWVBA.htm

Peter Jamieson
 
F

Frank P Florida

Thank you very much.

Peter Jamieson said:
When Word does a Mail Merge to printer, all the output is in a single Print
Job. 7Mb x 135 is approaching 1Gb which is quite a lot of /extra/ RAM even
by today's standards, and there is probably loads of extra overhead for
reasons I don't even want to think about!

One thing you can try in the simple case is to use VBA to do one merge per
record in the data source using a macro such as the following:

Sub PrintOneDocPerSourceRec()
Dim intSourceRecord
Dim objMerge As Word.MailMerge
'Dim strOutputDocumentName As String
Dim TerminateMerge As Boolean

' Need to set up this object as the ActiveDocument changes when the
' merge is performed. Besides, it's clearer.

Set objMerge = ActiveDocument.MailMerge
With objMerge

' If no data source has been defined, do it here using OpenDataSource.
' But if it is already defined in the document, you should not need
' to define it here.

' .OpenDataSource _
' Name:="whatever"

intSourceRecord = 1
TerminateMerge = False

Do Until TerminateMerge
.DataSource.ActiveRecord = intSourceRecord

' if we have gone past the end (and possibly, if there are no records)
' then the Activerecord will not be what we have just tried to set it to

If .DataSource.ActiveRecord <> intSourceRecord Then
TerminateMerge = True
' the record exists
Else

.DataSource.FirstRecord = intSourceRecord
.DataSource.LastRecord = intSourceRecord
.Destination = wdSendToPrinter
.Execute

intSourceRecord = intSourceRecord + 1
End If
Loop
End With
End Sub

You may also find the follwong useful:
http://word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm
http://word.mvps.org/FAQs/MailMerge/MergeStraightToPrintrWVBA.htm

Peter Jamieson
 

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