We help IT Professionals succeed at work.
Get Started

Getting a addresslist from a session object in Outlook VBA

phiro
phiro asked
on
1,417 Views
Last Modified: 2008-02-20
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.  
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE