Thread: OLE Question
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ralph Ralph is offline
external usenet poster
 
Posts: 79
Default OLE Question

Use GetContact with the address entry.

Cells(i, 1).Value = Entry.Name
Cells(i, 2).Value = Entry.GetContact.Email1Address
Cells(i, 3).Value = Entry.GetContact.Birthday
Cells(i, 4).Value = Entry.GetContact.BusinessAddress

"Office_Novice" wrote:

Greetings, I would like to use OLE to extact my address book from outlook.
What i have will get the names but i want all the info contained in the
address book any thoughts? Here is what i have found so far

Option Explicit
Public Sub DisplayOutlookContactNames()
Dim Outlook As Outlook.Application
Dim NameSpace As Outlook.NameSpace
Dim AddressList As AddressList
Dim Entry As AddressEntry
Dim i As Long

On Error GoTo Finally
Set Outlook = New Outlook.Application
Set NameSpace = Outlook.GetNamespace("MAPI")
Set AddressList = NameSpace.AddressLists("Contacts")
For Each Entry In AddressList.AddressEntries
i = i + 1
Cells(i, 1).Value = Entry.Name

Next

Finally:
'Outlook.Quit
Set Outlook = Nothing
End Sub