|
Question : Behavior of Word mail merge to e-mail from Access
|
|
Hello - I worked up a very basic routine (code below) to mail merge to either a new Word doc or to e-mail, and I'm wondering if what I'm seeing is normal:
1) I'm getting prompted once about "A program is trying to access e-mail addresses...", and then again about "A program is trying to automatically send e-mail..." for EVERY e-mail in the mail merge result. Is this normal ??? Any way to prevent this?
2) It looks like these e-mail's just sit in my Outbox unless Outlook is open at the time I run the mail merge. Is this "by design"? Is there some way I can force the messages to go out automatically?
Thanks
Mark
**************
Public Function MergeIt(Dest As String)
Dim objWord As Word.Document Set objWord = GetObject("C:\MailMerge\MailMerge.doc", "Word.Document") ' Make Word visible. objWord.Application.Visible = True ' Set the mail merge data source objWord.MailMerge.OpenDataSource Name:="C:\MailMerge\MailMerge.mdb", LinkToSource:=True, AddToRecentFiles:=False, _ SQLStatement:="SELECT * FROM [tblMailMerge]" Select Case Dest Case "print" objWord.MailMerge.Destination = wdSendToNewDocument Case "email" ' Execute the mail merge. objWord.MailMerge.MailSubject = "Please Read me!" objWord.MailMerge.MailFormat = wdMailFormatPlainText objWord.MailMerge.MailAddressFieldName = "EMailAddr" objWord.MailMerge.Destination = wdSendToEmail End Select objWord.MailMerge.Execute Set objWord = Nothing MsgBox "Finished..."
End Function
|
|
Answer : Behavior of Word mail merge to e-mail from Access
|
|
PS: For further information on the Object Model Guard, check this link ( http://www.outlookcode.com/d/sec.htm ).
|
|
|
|