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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
macro for word mailmerge
Hello
I want to seperate big mailmerge into 500 pages steps. Can me somebody help to create this macro? King regards in advanced. Dirk |
#2
|
|||
|
|||
macro for word mailmerge
In the simple case where you have a letter layout that uses one page and
always corresponds to a single record in the data source, you can use something like Sub batchmerge() ' number of records to process ' per batch Const BatchSize As Long = 500 ' a pathname for the output files ' We'll append the start record number ' (or you can merge to printer) Const FileStem = "c:\a\batch_starting_" Dim c As Long Dim objDoc As Word.Document c = 1 Set objDoc = ActiveDocument With objDoc.MailMerge .Destination = wdSendToNewDocument While c = .DataSource.RecordCount .DataSource.FirstRecord = c .DataSource.LastRecord = c + BatchSize - 1 .Execute ActiveDocument.SaveAs _ FileStem & CStr(c) ActiveDocument.Close c = c + BatchSize Wend End With Set objDoc = Nothing End Sub If each letter always consumes (say) 5 records in the data source then you could change Const BatchSize = 500 to Const BatchSize = 2500 However, if you have a more complicated letter where the number of records each letter consumes (e.g. you are producing invoices) then it's a different story because you do not actually know which record to start with each time, and I don't believ it is particularly easy to find out. Peter Jamieson http://tips.pjmsn.me.uk On 03/02/2010 15:38, Dirk wrote: Hello I want to seperate big mailmerge into 500 pages steps. Can me somebody help to create this macro? King regards in advanced. Dirk |
#3
|
|||
|
|||
macro for word mailmerge
See the “Individual Merge Letters” item on fellow MVP Graham Mayor’s website
at: http://www.gmayor.com/individual_merge_letters.htm -- Hope this helps, Doug Robbins - Word MVP Please reply only to the newsgroups unless you wish to obtain my services on a paid professional basis. "Dirk" wrote in message ... Hello I want to seperate big mailmerge into 500 pages steps. Can me somebody help to create this macro? King regards in advanced. Dirk |
Thread Tools | |
Display Modes | |
|
|