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

  • Thread starter Thread starter marie
  • Start date Start date
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
 
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
 
Back
Top