how do I read contact names from Outlook address book?

S

stephenc

I need to populate a listbox in Word with every forename and surname in the
Outlook Address Book (global address list). This is so that authors can use
the template and select their name form the listbox.

I'm using Word 2003 and Outlook 2002, but this may vary.
 
S

stephenc

Set myOlApp = CreateObject("Outlook.Application")
Set MyNameSpace = myOlApp.GetNamespace("MAPI")
Set myContacts = MyNameSpace.GetDefaultFolder(olFolderContacts).Items
Set myItems = myContacts

For Each MyItem In myItems
ListBox1.AddItem MyItem.FullName
Next

I am getting a runtime errormessage suggesting that a parameter is not valid.

I admit I don't fully understand the first part of the code, so am keen to
learn as well as find a solution to the problem.
 
Top