Solved

Behavior of Word mail merge to e-mail from Access

Posted on 2006-11-19
3
1,335 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

635 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