Fandt ellers denne programstump på
http://support.microsoft.com/?kbid=329765Men kan ikke finde ud af at avende det med succes :- )
----------------------------
SYMPTOMS
If you try to gain access to the Address Book programmatically by using the Outlook object model when Outlook is not running, you may receive the following security prompt, even though Allow access to address book via Outlook object model is correctly enabled in the Outlook 10 Security Settings Folder.
A program is trying to access e-mail addresses you have stored in Outlook. Do you want to allow this?
If this is unexpected, it may be a virus and you should choose "No".
Back to the top
CAUSE
This behavior occurs because there is no running session of Outlook to determine the correct security profile to load. Therefore, the default security profile is used, causing the security prompt.
When you programmatically access an item in the Address Book, a session must be running to determine the correct security profile to load. When Microsoft Outlook 2002 is not running, the security dialog prompts the user because the default security profile is used.
Back to the top
WORKAROUND
To work around this issue, use the second code example in this section.
For example, this Visual Basic Scripting (VBS) Language code causes the security prompt to appear: Set ol = CreateObject("Outlook.Application")
Set AL = ol.session.addresslists("Global Address List")
Set AE = AL.addressEntries(1)
MsgBox AE.address
The following code works around the issue by causing a persistent reference to the established Outlook session, and therefore does not raise the security prompt: Set ol = CreateObject("Outlook.Application")
Set session = ol.session
Set AL = ol.session.addresslists("Global Address List")
Set AE = AL.addressEntries(1)
MsgBox AE.address