I am using the code below to merge and print renewals.
Function MergeIt()
Dim objWord As Word.Document
‘path of renewal document
Set objWord = GetObject(“c:MLSRenewal.doc”, “Word.Document”)
objWord.Application.Visible = True
‘path of database
objWord.MailMerge.OpenDataSource Name:=”C:MLSmls.mdb”, _
LinkToSource:=True, Connection:=”QUERY qryXngPermitLetter”, _
SQLStatement:=”SELECT * FROM [qryXngPermitLetter]”
objWord.MailMerge.Destination = wdSendToNewDocument
objWord.MailMerge.Execute
objWord.Application.Options.PrintBackground = False
objWord.Application.ActiveDocument.PrintOut
objWord.Application.Quit
Problem is, 1) At the end I get messages asking if I want to save FormLetter 1……. and a message asking if I want to save changes to the renewal.doc.. Is there some changes I can make to eliminate these messages? Obvious novice.
And 2) Word does not close, and this has to be done manually. Access97 and Word97