Word Mail Merge automation.
Outlook E-mail Security Update issues. Security Guard
Security Manager 2007
for Microsoft® Outlook®
What Outlook versions trigger security alerts on Mail Merge?
Starting from the Outlook 2000 E-mail Security Update the developers who use the Office Mail Merge functionality run into security prompts that the Outlook Security Guard triggers on Mail Merge automation. If you automate Mail Merge from inside of your applications, you get the security alert on Outlook 2000 with service pack 2 and higher, Outlook 2002, Outlook 2003 or Outlook 2007. The Outlook Email Security Guard triggers the following security prompts:
A program is trying to access e-mail addresses you have stored in Outlook

A program is trying to automatically send e-mail on your behalf

What Outlook Security Manager provides to avoid Outlook security prompts on Mail Merge
Below you can see a stand-alone example that runs Outlook and Word, opens a prepared Mail Merge document and executes Mail Merge. This example uses Outlook Security Manager ActiveX that allows you to avoid Outlook security prompts.
Visual Basic 6.0 (VBA)
| Private Sub Command1_Click() |
| Dim OutlookApp As New Outlook.Application |
| Dim SecurityManager As New OutlookSecurityManager |
| Dim WordApp As New Word.Application |
| Dim WordDoc As Word.Document |
| Dim MailMerge As Word.MailMerge |
| WordApp.Visible = True |
| ' Connects to an Outlook instance |
| SecurityManager.ConnectTo OutlookApp.Application |
| ' Disables security warnings on accessing Outlook objects |
| SecurityManager.DisableOOMWarnings = True |
| On Error GoTo Finally |
| Set WordDoc = WordApp.Documents.Open(CurDir() & "\Test.doc", True) |
| Set MailMerge = WordDoc.MailMerge |
| MailMerge.OpenDataSource Name:=CurDir() & "\Test.mdb", _ |
| SQLStatement:="SELECT * FROM [Office_Address_List]" |
| MailMerge.MailAddressFieldName = "Email_Address" |
| MailMerge.DataSource.FirstRecord = wdDefaultFirstRecord |
| MailMerge.DataSource.LastRecord = wdDefaultLastRecord |
| MailMerge.MainDocumentType = wdEMail |
| MailMerge.Destination = wdSendToEmail |
| MailMerge.Execute False |
| Finally: |
| ' In any case, please remember to turn on Outlook security warnings |
| ' after your code, since now it is very easy to switch it off! |
| SecurityManager.DisableOOMWarnings = False |
| End Sub |
The code example above is in Visual Basic 6.0, but Outlook Security Manager supports all .NET programming language including Visual Basic .NET, C#, C++, J#, Delphi for .NET, RemObjects Chrome as well as Delphi for Win32, Visual C++ 6, Visual Basic for Applications including Access VBA, Excel VBA, VBScript, JScript, etc.
Find more about how to avoid Outlook security messages like: A program is trying to...

