G
Guest
I have created an automated mailmerge using the following code, it is set up
to email the mailmerge, but I can't figure out how to answer to the two
questions it is asking me. First in word it asks, "Opening this document
will run the following SQL command: SELECT * FROM [contacts1] Data
will be placed in the document. Do you want to continue? (I always want to
say yes to this)
Second: A program is trying to access outlook to send an email do you want
to allow this. This message will pop up for as many recipients as i have in
the table so i need some type of loop to continuously answer yes.
All help is much appreciated.
Dim objWord As Word.Document
Set objWord = GetObject("C:\Documents and
Settings\jclark\Desktop\test.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\jclark\My Documents\Flottweg\Engineering\Access files\Access Data
Backup\test.mdb", LinkToSource:=True, Connection:="TABLE Contacts1",
SQLStatement:="SELECT * FROM [contacts1]"
' Execute the mail merge.
objWord.MailMerge.Destination = wdSendToEmail
objWord.MailMerge.Execute
to email the mailmerge, but I can't figure out how to answer to the two
questions it is asking me. First in word it asks, "Opening this document
will run the following SQL command: SELECT * FROM [contacts1] Data
will be placed in the document. Do you want to continue? (I always want to
say yes to this)
Second: A program is trying to access outlook to send an email do you want
to allow this. This message will pop up for as many recipients as i have in
the table so i need some type of loop to continuously answer yes.
All help is much appreciated.
Dim objWord As Word.Document
Set objWord = GetObject("C:\Documents and
Settings\jclark\Desktop\test.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\jclark\My Documents\Flottweg\Engineering\Access files\Access Data
Backup\test.mdb", LinkToSource:=True, Connection:="TABLE Contacts1",
SQLStatement:="SELECT * FROM [contacts1]"
' Execute the mail merge.
objWord.MailMerge.Destination = wdSendToEmail
objWord.MailMerge.Execute