a program is trying to access e-mail address - how do I avoid this

M

marie

In my vba code I'm receiving the following error "a program is trying
to access e-mail addresses you have stored in outlook. Do you want to
allow this?..." I'm not accessing addresses at all so I don't know why
the error message is appearing. I've been able to isolate the error to
the final line of code below where I'm appending text - does anyone
know how I can avoid this msg from appearing??



Sub test()
Dim myOlApp As New Outlook.Application

'check if this is a mail object first
If myOlApp.ActiveInspector.CurrentItem.Class = olMail Then
myOlApp.ActiveInspector.CurrentItem.Subject = "test"

'append to email body
myOlApp.ActiveInspector.CurrentItem.Body =
myOlApp.ActiveInspector.CurrentItem.Body & " appending new text"

End If
End Sub
 
S

Sue Mosher [MVP-Outlook]

The Body property is also subject to the "object model guard." See http://www.outlookcode.com/d/sec.htm for your options.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top