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
Solved

Behavior of Word mail merge to e-mail from Access

Posted on 2006-11-19
3
1,319 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
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…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

856 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