B
Bob Hynes
Hi All,
This code is running in WinNT/Access97. I'm looking for some help with
getting this code to do two(2) things better then it does now and I'm
not sure how to do it.
1. On the 'objWord.Application.Quit' statement, it asks if I want to
save changes on the Word document and I would like it to not ask that
and I don't know what the exact code is to do that.
2. On the 'objWord.MailMerge.Execute' statement the printer dialog
window pops up and I have to click Ok in order for it to start
printing, how do I pass the OK click to the printer dialog box? I was
thinking something like BackgroundPrinting=OK but, again I don't know
what the exact code is.
Thanks for any and all help
bobh.
Dim objWord As Word.Document
Set objWord = GetObject("\\Homafsf6\Vol2\Breakpoint\Documentation\BPPaymentLtr.doc",
"Word.Document")
'make Word visible.
objWord.Application.Visible = True
'set the mail merge data source as the database containing the mail
merge data.
objWord.MailMerge.OpenDataSource _
Name:="\\Homafsf6\Vol2\Breakpoint\Data\BreakpointDb.mdb", _
LinkToSource:=True, _
Connection:="Table tblApprovedLetters", _
SQLStatement:="Select * from [tblApprovedLetters]"
'execute the mail merge.
objWord.MailMerge.Destination = wdSendToPrinter
objWord.MailMerge.Execute
'close the Word application
objWord.Application.Quit
Set objWord = Nothing
This code is running in WinNT/Access97. I'm looking for some help with
getting this code to do two(2) things better then it does now and I'm
not sure how to do it.
1. On the 'objWord.Application.Quit' statement, it asks if I want to
save changes on the Word document and I would like it to not ask that
and I don't know what the exact code is to do that.
2. On the 'objWord.MailMerge.Execute' statement the printer dialog
window pops up and I have to click Ok in order for it to start
printing, how do I pass the OK click to the printer dialog box? I was
thinking something like BackgroundPrinting=OK but, again I don't know
what the exact code is.
Thanks for any and all help
bobh.
Dim objWord As Word.Document
Set objWord = GetObject("\\Homafsf6\Vol2\Breakpoint\Documentation\BPPaymentLtr.doc",
"Word.Document")
'make Word visible.
objWord.Application.Visible = True
'set the mail merge data source as the database containing the mail
merge data.
objWord.MailMerge.OpenDataSource _
Name:="\\Homafsf6\Vol2\Breakpoint\Data\BreakpointDb.mdb", _
LinkToSource:=True, _
Connection:="Table tblApprovedLetters", _
SQLStatement:="Select * from [tblApprovedLetters]"
'execute the mail merge.
objWord.MailMerge.Destination = wdSendToPrinter
objWord.MailMerge.Execute
'close the Word application
objWord.Application.Quit
Set objWord = Nothing