Link to home
Start Free TrialLog in
Avatar of mutrus
mutrus

asked on

CDO and the Address book

Using MAPI I can open the address book using

MAPIMessage.Action = vbMessageShowAddressBook

and then with code copy the selected addresses into a variable

How can I achieve the same using CDO 1.x

Avatar of Neo_mvps
Neo_mvps

' Using CDO 1.x

' Explicit declares require one to add a reference to the
' CDO library

Dim oSession As MAPI.Session
Dim oRecipients As MAPI.Recipients

Set oSession = CreateObject("MAPI.Session")

' logon to the session
oSession.Logon "Profile", "Password", False, False

' if Outlook is already running then we could have done
' the following to piggy back on existing session
' oSession.Logon "","", False, False


' Recipients is a collection
Set oRecipients = oSession.AddressBook

' warning if user presses the cancel button, it will
' raise an error that you will have to catch and handle

ASKER CERTIFIED SOLUTION
Avatar of Neo_mvps
Neo_mvps

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mutrus

ASKER

Thanks