S
Simon
I have a button on my form that runs the code below which will open up
a mailmerge doc and print it automaticaly
when i run it it brings up a message
' Opening this document will run the following SQL command
SELCT *FROM [qryBrochure]
Data from your database will be placed in the document. DO you want to
continue?
I then click YES eevery time. Is there a way for it to select yes every
time automatical
Other little thing is that once the document has been printed
automatiucal is there a way to get Word to exit
Thanks
Simon
Dim objWord As Word.Document
Set objWord = GetObject("C:\Documents and Settings\Simon\My
Documents\BroLetterTest.doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as the Northwind database.
objWord.MailMerge.OpenDataSource _
Name:="C:\Documents and Settings\Simon\My Documents\Hot Tubs 2
Buy\Database\Hot Tubs 2 Buy sql.mdb", _
LinkToSource:=True, _
Connection:="Query qryBrochure", _
SQLStatement:="SELECT * FROM [qryBrochure]"
objWord.MailMerge.Destination = wdSendToPrinter
objWord.MailMerge.Execute
a mailmerge doc and print it automaticaly
when i run it it brings up a message
' Opening this document will run the following SQL command
SELCT *FROM [qryBrochure]
Data from your database will be placed in the document. DO you want to
continue?
I then click YES eevery time. Is there a way for it to select yes every
time automatical
Other little thing is that once the document has been printed
automatiucal is there a way to get Word to exit
Thanks
Simon
Dim objWord As Word.Document
Set objWord = GetObject("C:\Documents and Settings\Simon\My
Documents\BroLetterTest.doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as the Northwind database.
objWord.MailMerge.OpenDataSource _
Name:="C:\Documents and Settings\Simon\My Documents\Hot Tubs 2
Buy\Database\Hot Tubs 2 Buy sql.mdb", _
LinkToSource:=True, _
Connection:="Query qryBrochure", _
SQLStatement:="SELECT * FROM [qryBrochure]"
objWord.MailMerge.Destination = wdSendToPrinter
objWord.MailMerge.Execute