Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Dirk Dirk is offline
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default 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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default macro for word mailmerge

See the €śIndividual Merge Letters€ť item on fellow MVP Graham Mayors 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


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Issues w/ Word MVP Macro to Mailmerge w/ Attachment The Mysterious J Mailmerge 4 August 5th 09 06:45 PM
Mailmerge macro doesn't work in WORD 2007 [email protected] Mailmerge 9 June 3rd 08 12:47 PM
Mailmerge and Macro uriahheep Mailmerge 1 December 7th 06 03:56 PM
MailMerge Macro HELP Dirdata via OfficeKB.com Microsoft Word Help 1 October 6th 06 11:14 AM
Word mailmerge to PDF macro Martin Mailmerge 2 April 13th 06 06:31 AM


All times are GMT +1. The time now is 04:51 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"