Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 351
  • Last Modified:

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

0
mutrus
Asked:
mutrus
  • 2
1 Solution
 
Neo_mvpsCommented:
' 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

0
 
Neo_mvpsCommented:
Changing comment to answer...
0
 
mutrusAuthor Commented:
Thanks
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now