|
-
July 2nd, 2001, 07:20 AM
#1
Outlook97 Addressbook
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
-
July 2nd, 2001, 08:16 AM
#2
Re: Outlook97 Addressbook
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
[email protected]
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
-
July 2nd, 2001, 09:09 AM
#3
Re: Outlook97 Addressbook
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|