Word 2000 / Excel 2000 - Mailmerge

  • Thread starter Sandra Jackson via OfficeKB.com
  • Start date
S

Sandra Jackson via OfficeKB.com

I have a five-page Word document which I need to email to 2,000 clients. I
need to insert merge fields on each page. Can Word cope with 10,000 pages in
one document or should I merge in batches?
Thanks
 
P

Peter Jamieson

Word should certainly be able to create and save a 10000-page document
(forgetting about the Mailmerge aspect of things for a moment) as long as
there is nothing large (such as images) repeated every few pages and as long
as the overall field code count (probably excluding PAGE fields etc. in
headers/footers) is not high. However,
a. messages posted in this group suggest that sometimes Word mailmerge
starts skipping records etc. for no apparent reason during merges.
b. if you are emailing the results, are you going to merge directly to
e-mail, in which case Word only creates an e-mail with a 5-page attachment,
or an email with a fairly long message body, depending on how you are doing
it? Or are you going to merge to a new document then split it and do the
emailing as a separate operation?

In my opnion, batching is advisable in any case when you are trying this
kind of process for the first time.

Peter Jamieson
 
S

Sandra Jackson via OfficeKB.com

There are no images to insert and about 14 field codes in total, made up of:
5 for name and adress and 9 inserting figures. The results are to be printed
to a photocopier.

As I am new to Word / Excel 2000, my understanding of 'batching' is to: merge
and print, say, for example, record 1 to 250, 251 - 500, etc. Is this
correct?

I have been asked to confirm how long I think it would be to prepare and
merge the statements ready for printing. As the main document and data are
already prepared, am I correct in thinking that merging the statements ready
for printing would be 5 to 10 mins at the most?

Your advice would be greatly appreciated.
 
S

Sandra Jackson via OfficeKB.com

Sorry, I've just re-read my original question and apologise for suggesting
this merge was to be emailed - the end result is to be printed.

Sandra
 
P

Peter Jamieson

In that case, my suggestion is that since everything is ready, just
experiment, i.e. merge to an output document and see how long it takes. If
you're concerned that it might take forever, try 100 records at first - that
should give you some idea of the likely run time. Then increase it (you may
find that there is sudden degradation at various points - if so, consider a
batch size that avoids performance degradation. If the whole thing seems to
run just fine, I wouldn't bother with the batching.

And yes, your description of the batching is what I meant. You can use a bit
of macro code to do several batches if you want.

Peter Jamieson
 
S

Sandra Jackson via OfficeKB.com

When you say I could use a macro code do I just record the steps needed to
perform several batches?

Sandra
 
P

Peter Jamieson

I think the following code will do roughly what you need but it needs to be
tested in your environment and may need all sorts of work depending on how
robust it needs to be.


Peter Jamieson

Sub MergeInBatches()
' NB, needs better error management and doubtless
' other things a VBA expert will point out.

' Define the number of records per batch
Const LBatchSize = 200

' Define a name for the output files. In this case
' the files will be called batch1.doc, batch2.doc etc.
' The path defined in this Stem must exist before you
' execute this macro. Files with the name batch1.doc
' etc. will be overwritten
Const SOutputDocumentNameStem = "c:\mymergeoutput\batch"
Dim lBatch As Long
Dim lStartRecord As Long
Dim lSourceRecord As Long
Dim oMerge As Word.MailMerge
Dim sOutputDocumentName As String
Dim bTerminateMerge As Boolean

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

Set oMerge = ActiveDocument.MailMerge
With oMerge

' 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"

bTerminateMerge = False
lBatch = 0
Do
lBatch = lBatch + 1
lStartRecord = ((lBatch - 1) * LBatchSize) + 1
.DataSource.ActiveRecord = lStartRecord

' 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 <> lStartRecord Then
bTerminateMerge = True
Else
' we have some records to merge
.DataSource.FirstRecord = lStartRecord
.DataSource.LastRecord = lStartRecord + LBatchSize - 1

.Destination = wdSendToNewDocument
.Execute

' create the output file name for this batch

sOutputDocumentName = _
SOutputDocumentNameStem & _
Trim(CStr(lBatch)) & _
".doc"


' The Activedocument is always the output document
' Add any parameters you need to these calls
ActiveDocument.SaveAs sOutputDocumentName
ActiveDocument.Close savechanges:=wdDoNotSaveChanges
End If
Loop Until bTerminateMerge
End With
End Sub
'----------------
 
S

Sandra Jackson via OfficeKB.com

I'm really grateful for all your help - I'll test the macro tomorrow.

Sandra
 

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