O
Office_Novice
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
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