Getting a addresslist from a session object in Outlook VBA
Posted on 1999-06-30
I have a function in Access that creates a CDO (Used to be called Active Messaging) session.
From this session I try to get the Address list. But I get a type mismatch on anything I do
This is a example of the code I use.
Dim Ses As Session
Dim outL As Outlook.Application
Dim adrList As AddressList
Set outL = GetObject(, "Outlook.Application")
Set Ses = outL.Session
Set adrList = Ses.GetAddressList(CdoAddressListGAL)
It is not only this one, non of the objects linked to the Session object can be set to another object. Everything fails with a Type mismatch.
Every permutation that came to my mind I have tried. declaring all the var's as Objects etc. References are to Outlook98 Objects and CDO 1.21. Tried it on new databases.
OS : win95, Exchange 5.5, Access97, Outlook98. I work at the client side of the mail application.
The Session object is a valid object of a running session with Outlook.
One extra oddity is that setting a reference to Access of the CDO object - library adds it's objects twice. So if I do a Dim x as ... generates a list with the CDO objects twice.
There is only one instance of the cdo.dll present on this system or in the paths specified by the PATH variable.