Your options are limited because you are not technically doing Outlook automation at all. If you want to stick with that code, you'd have to use one of the tools on the page Dmitry suggested that suppresses the prompts. If, on the other hand, you want the prompts to disappear completely, with Outlook 2007 and an up-to-date anti-virus application running on your system, you will get no prompts if you use the Outlook object model directly in your code.
It's up to you now to decide whether it's worth the effort to rewrite the code to use the Outlook object model or use one of the utilities on the page Dmitry suggested.

Signature
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx
> Ok, so I'm a little confused. Which code do I use and where should I insert
> it into my macro?
[quoted text clipped - 32 lines]
>
>> See http://www.outlookcode.com/d/sec.htm
>>>I am running a macro in excel that email merges through Outlook 07. I
>>>would like to find code to avoid getting the "a program is trying to
>>>access email address information stored in Outlook" message. Is there
>>>such?
I think the easiest way would be to insert the code because I'm not doing
the outlook automation. Although I am still confused where I would put that
particular line of code: objMailItem.To = webmaster@outlookcode.com to
suppress the security prompt.
Here is my whole macro that I am trying to run.....
Sub Ecology()
'This first macro opens word for the rest of the macros. It also merges data
from Referals.xls, worksheet one, into different merge fields on the
document stated in the macro.
Dim wdApp As Object
Dim myDoc As Word.Document
Set wdApp = CreateObject("Word.Application")
Set myDoc = Word.Documents.Open("\\powervault2\home_pl\common\Email\Referal
Agency - Ecology.doc")
myDoc.MailMerge.MainDocumentType = wdEMail
myDoc.MailMerge.OpenDataSource Name:= _
"\\powervault2\home_pl\common\Email\Referals.xls", _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="",
_
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False,
_
Format:=wdOpenFormatAuto, Connection:= _
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data
Source=\\powervault2\home_pl\common\Email\Referals.xls;Mode=Read;Extended
Properties=""HDR=YES;IMEX=1;"";Jet OLEDB:System database="""";Jet
OLEDB:Registry Path="""";Jet OLEDB:Database Pa" _
, SQLStatement:="SELECT * FROM `Sheet1$`", SQLStatement1:="",
SubType:= _
wdMergeSubTypeAccess
With myDoc.MailMerge
.Destination = wdSendToEmail
.MailAddressFieldName = "Address"
.MailSubject = "Referals"
.MailAsAttachment = True
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False
End With
myDoc.Close wdDoNotSaveChanges
End Sub
Your options are limited because you are not technically doing Outlook
automation at all. If you want to stick with that code, you'd have to use
one of the tools on the page Dmitry suggested that suppresses the prompts.
If, on the other hand, you want the prompts to disappear completely, with
Outlook 2007 and an up-to-date anti-virus application running on your
system, you will get no prompts if you use the Outlook object model directly
in your code.
It's up to you now to decide whether it's worth the effort to rewrite the
code to use the Outlook object model or use one of the utilities on the page
Dmitry suggested.

Signature
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx
> Ok, so I'm a little confused. Which code do I use and where should I
> insert
[quoted text clipped - 35 lines]
>
>> See http://www.outlookcode.com/d/sec.htm
>>>I am running a macro in excel that email merges through Outlook 07. I
>>>would like to find code to avoid getting the "a program is trying to
>>>access email address information stored in Outlook" message. Is there
>>>such?
Sue Mosher [MVP-Outlook] - 29 Mar 2007 20:22 GMT
Setting the value of objMailItem.To would never raise a security prompt. This is not a simple "insert the code" project. You would have to complete rewrite the code in two phases:
1) Perform a merge to create and save individual Word documents
2) For each document created in the merge, create and send an individual Outlook MailItem (message). The MailItem.Send method would trigger a security prompt unless the code is running in Outlook or you use Redemption or one of the other approaches listed on the page suggested.

Signature
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx
>I think the easiest way would be to insert the code because I'm not doing
> the outlook automation. Although I am still confused where I would put that
[quoted text clipped - 99 lines]
>>>>access email address information stored in Outlook" message. Is there
>>>>such?