How can I print a letter for each record in my mailmerge table?

K

KZeeh

I am trying to rewrite some code from word.basic to use word.application b/c
some of it is not working in XP. I have had some luck with another program
but this one is not working properly. It is only printing a letter for the
first record in the table instead of a letter for each record in the table.
Here is most of the code. Does anyone see something that I am missing??
Thank you.
*****
oDoc = oWord.Documents.Open("test.doc")
oDoc.MailMerge.MainDocumentType = 0
oDoc.MailMerge.OpenDataSource;
(dsname,wformat,wconfirmconv,wreadonly,wlinktosource,;
waddtofilelist,wpassworddoc,wpasswordtemp,wrevert,;
wprotectdoc,wprotecttemp,wconn,wsqlstatement)

oWord.Documents(1).Activate
oWord.Printout()
oDoc.Close
******
 
D

Doug Robbins

If you want to send each letter as a separate print job, better to execute
the merge to a new document and then run the following macro

Dim i as Long
For i = 1 to ActiveDocument.Sections.Count
ActiveDocument.PrintOut Range:=wdPrintFromTo, From:="s" & i, To:="s" & i
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
 

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