Click to See Complete Forum and Search --> : Outlook97 Addressbook


Rob@SYPTE
July 2nd, 2001, 07:20 AM
Help please,

I am trying to read the outlook 97 address book into a combo box with the following code but it gives an error.

Object does not support this property or method

Dim myOlApp As Object
Dim myNameSpace As Object
Dim myAddressList As Object
Dim myAddressEntries As Object
Dim i As Integer

Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myAddressList = myNameSpace.AddressLists("Contacts")
Set myAddressEntries = myAddressList.AddressEntries

With cboFaxNumbers
.AddItem myAddressEntries.GetFirst

For i = 2 To myAddressEntries.Count
.AddItem myAddressEntries.GetNext
Next i
End With

Help appreciated

Cheers

Rob

Cakkie
July 2nd, 2001, 08:16 AM
I'm not sure there's a thing like Addresslist, but you can use the contacts.

Dim myOlApp as Object
Dim myNameSpace as Object
Dim myContacts as Object
Dim myContact as Object
Dim i as Integer

set myOlApp = CreateObject("Outlook.Application")
set myNameSpace = myOlApp.GetNamespace("MAPI")
set myContacts = myNameSpace.GetDefaultFolder(olFolderContacts)

for t = 1 to myContacts.Items.Count
MsgBox myContacts.Items(t).Email1Address
next t



Other things you can use in stead of Email1Address are things like BusinessFaxNumber, HomePhoneNumber, Birthday and a whole bunch of other stuff (to much to list)

Tom Cannaerts
slisse@planetinternet.be

Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook

Rob@SYPTE
July 2nd, 2001, 09:09 AM
Cheers Cakkie

Half the battle won but I'm after a folder that is not Contacts but the Global Address List.

Any Ideas?

Cheers

Rob