Cant access Outlook PropertyAccessor RRS feed

  • Question

  • Hello everybody,

    i'm creating an Outlook mail via VBA (Outlook 2016). Therefore i´m using the examples from the Microsoft documentation. The creation and display of the mail works properly. But i have to set a mail-header and so i'm trying to set a property through the PropertyAccessor.


    Sub CreateEmail()
        Dim objOutlook
        Set objOutlook = CreateObject("Outlook.Application")
        Dim objMailItem
        Set objMailItem = objOutlook.CreateItem( 0 )
        objMailItem.Subject = "Test Subject"
        objMailItem.To = ""
        Dim oPA
        Set oPA = objMailItem.PropertyAccessor 
    End Sub

    But i can´t access the PropertyAccessor. I´m getting a script error on the line:

    Set oPA = objMailItem.PropertyAccessor

    with no further information. Searching through this forum, i´ve found an older thread in which a user had the same problem which was caused by security policies (

    Has anybody an idea why i#m getting an error / which security policy is resbonsible for that?. 

    Thank You

    • Edited by Shamy1988 Monday, June 24, 2019 10:55 AM
    Monday, June 24, 2019 9:33 AM

All replies

  • Hello,

    Do you get any errors when you call the Send method (without calling the PropertyAccessor)?

    "Security" in this context refers to the so-called "object model guard" that triggers security prompts and blocks access to certain features in an effort to prevent malicious programs from harvesting email addresses from Outlook data and using Outlook to propagate viruses and spam. These prompts cannot simply be turned off, except in latest Outlook versions with an anti-virus application running. This page discusses strategies for avoiding the security prompts.

    Also you may find the "A program is trying to send an e-mail message on your behalf" warning in Outlook article helpful. 

    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Monday, June 24, 2019 9:41 AM