Solved

Behavior of Word mail merge to e-mail from Access

Posted on 2006-11-19
3
1,293 Views
Last Modified: 2007-12-19
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
0
Comment
Question by:mlagrange
  • 2
3 Comments
 
LVL 16

Expert Comment

by:GreymanMSC
ID: 17976789
Oh, yes, it is now normal behaviour.

Welcome to Outlook 2002+.  

In an attempt to prevent email viral propogation, Outlook now refuses to allow automated email generation without explicit user interation.  Which is annoying when it's your own code, but sensible.
0
 
LVL 16

Accepted Solution

by:
GreymanMSC earned 500 total points
ID: 17976915
PS: For further information on the Object Model Guard, check this link ( http://www.outlookcode.com/d/sec.htm ).

0
 

Author Comment

by:mlagrange
ID: 17978285
Ok, thanks for the link

Any idea about the second part (messages sitting in the Outbox)?

Thanks

Mark
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now