Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Reading Outlook address book in MS Access VBA code

812 views
Skip to first unread message

mscertified

unread,
Apr 11, 2008, 12:29:00 PM4/11/08
to
I read an Outlook address folder in an MS Access database (to populate a
table).
I always get this annoying warning prompt "A program is attempting to access
email addresses you have stored in Outlook. Do you want to allow this?"
Is there any way to suppress this message? It is going to annoy my users.
I usually respond to allow access for one minute which is sufficient for the
code to run.
Thanks for any advice.

Sue Mosher [MVP-Outlook]

unread,
Apr 11, 2008, 12:54:52 PM4/11/08
to
See http://www.outlookcode.com/article.aspx?ID=52 for your options with regard to the "object model guard" security in Outlook 2000 SP2 and later versions.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"mscertified" <rup...@tigerlily.com> wrote in message news:31D9B4DC-950A-4CA6...@microsoft.com...

mscertified

unread,
Apr 11, 2008, 2:46:04 PM4/11/08
to
Thank you for the link to that very informative web page.
Unfortunately, it really goes beyond my level of understanding of Outlook.
Do I understand correctly that since I am using Access instead of Outlook,
there is no way to rearrange the VB code to eliminate this warning? The other
solutions seem impractical since I have no control over our execution
environment, nor the ability to download any software.
Here is the code, in case it is of help:

Dim olmyApp As Outlook.Application
Dim olmyNameSp As Outlook.NameSpace
Dim olmyFolders As Outlook.Folders
Dim olFolder As Outlook.MAPIFolder
Dim olHiCs As Outlook.Items
Dim olHiC As Outlook.ContactItem
'
Set olmyApp = CreateObject("Outlook.Application")
Set olmyNameSp = olmyApp.GetNamespace("MAPI")
Set olmyFolders = olmyNameSp.Folders
'
Set olFolder = olmyFolders("Public Folders").Folders("All Public Folders"). _
Folders("Hawaii").Folders("Hawaii Contacts")
Set olHiCs = olFolder.Items

' Read Outlook folder and update Client table
For i = 1 To olHiCs.Count
If olHiCs.Item(i).Class = olContact Then 'Process the item if it is a
contact
Set olHiC = olHiCs.Item(i)
.......
.Fields("Email").Value = olHiC.Email1Address '<=== Triggers warning
.......
End If
Next

Sue Mosher [MVP-Outlook]

unread,
Apr 11, 2008, 3:04:00 PM4/11/08
to
> Do I understand correctly that since I am using Access instead of Outlook,
> there is no way to rearrange the VB code to eliminate this warning?

Yes, that is correct for versions before Outlook 2007. You would need to recode using the Redemption library (highly recommended) or use one of the utilities that bypasses the prompts.

Since you are using public folders, you could also consider using WebDAV to communicate directly with the Exchange server, rather than going through Outlook. Exchange documentation starts at http://msdn.microsoft.com/exchange/ with discussions in the microsoft.public.exchange.development newsgroup or on the Web at http://forums.microsoft.com/TechNet/ShowForum.aspx?ForumID=838&SiteID=17 . This article introduces some basic concepts and provides links to other resources:

http://weblogs.asp.net/whaggard/archive/2007/01/30/how-do-i-access-my-outlook-contacts-from-my-web-application.aspx


--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"mscertified" <rup...@tigerlily.com> wrote in message news:EAB09571-4B5D-46C9...@microsoft.com...

0 new messages