Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2005

Tip: Looking for answers? Try searching our database.

how do I read contact names from Outlook address book?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
stephenc - 10 Mar 2005 16:33 GMT
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.
Signature

Thanks in advance,
Stephenc

stephenc - 11 Mar 2005 15:33 GMT
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.

> 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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.