MS Word Mail Merges?

nhess
02-27-2001, 10:41 PM
I am using MS Word's Mail Merge to create personalized certificates from a MS Access Database, I have it all working, but now I want to program a simple loop to go through all records and print them all out automatically. So I thought I would just put a DO While loop in there and it would work, but how do you specify Do While NOT eof() because this has not been working, so I tried rs.eof() and set my recordset up,but that did not work. Can someone tell me where to start or any info.
Thanks,

nhess
02-27-2001, 10:43 PM
Sub Macro1()

Dim MyMerge As MailMerge
Set MyMerge = ActiveDocument.MailMerge

ActiveDocument.MailMerge.ViewMailMergeFieldCodes = wdToggle
ActiveDocument.MailMerge.DataSource.ActiveRecord = wdFirstRecord

Do While Not EOF()
If MyMerge.State = wdMainAndDataSource Then
SendKeys "{enter}"
With ActiveDocument.MailMerge
.Destination = wdSendToPrinter
.Execute
End With
End If

Loop

End Sub

Also, am I using the sendkey in the correct place?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum