Accessing Outlooks Contact List

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I display the address book that outlook uses so that I can prompt the
user to select a person to send the email to?

I am wanting to do this from a MS Excel form.

Thank you in advance.
 
Hi Ben,

if OL is running then you can use the commandbars. You won´t get the
selected item directly, but the user has the ability to send a mail.

Dim oCmd as Office.CommandBarButton
Dim oBars as Office.CommandBars

Set oBars = Application.ActiveExplorer.CommandBars
Set oCmd = oBars.FindControl(,353)
If Not oCmd Is Nothing Then
oCmd.Execute
Endif
 
The AddressBook dialog isn't exposed to the Outlook object model. You would
need to use CDO 1.21 (optional installation) or Redemption
(www.dimastr.com/redemption) to display it. In CDO you use code like this:

Dim oCDO As MAPI.Session
Dim colRecips As MAPI.Recipients

Set oCDO = CreateObject("MAPI.Session")
oCDO.Logon "", "", False, False 'Outlook must be running for this way to
work
Set colRecips = oCDO.AddressBook

Of course you'd also have to test for Cancel being pressed and how many
recipients were selected. In addition, CDO Recipients aren't the same as
Outlook Recipients so you can't assign one to the other directly.

See www.cdolive.com/cdo5.htm and www.cdolive.com/cdo10.htm for more CDO
information.
 
Back
Top