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 / December 2004

Tip: Looking for answers? Try searching our database.

Outlook Connection

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kerry - 01 Dec 2004 11:47 GMT
I have created a user form which shows me a list of the
contacts I have in my Outlook account.  Upon choosing a
contact the details are passed to variables which are
then used to address letters, labels etc.

The list of contacts are not showing in alphabetical
order, can anyone please advsie on how to sort this list?

Please find my code below, many thanks for your time:-

recipient:
   x = 0
   Set oApp = CreateObject("Outlook.Application")
   Set oNspc = oApp.GetNamespace("MAPI")

   For Each oItm In _
     oNspc.GetDefaultFolder(olFolderContacts).Items

     If oItm.Class = olContact Then 'no DL used
       With Me.RecipList
           .AddItem (oItm.FullName)
           .Column(1, x) = oItm.JobTitle
           .Column(2, x) = oItm.CompanyName
           .Column(3, x) = oItm.BusinessAddress
           .Column(4, x) = oItm.BusinessTelephoneNumber
           .Column(5, x) = oItm.BusinessFaxNumber
       End With
           x = x + 1
     End If
   Next oItm
Jean-Guy Marcil - 01 Dec 2004 14:07 GMT
Kerry was telling us:
Kerry nous racontait que :

> I have created a user form which shows me a list of the
> contacts I have in my Outlook account.  Upon choosing a
[quoted text clipped - 3 lines]
> The list of contacts are not showing in alphabetical
> order, can anyone please advsie on how to sort this list?

Buld an array, sort the array and then load the box with the Array using the
List method.

Try this
   http://word.mvps.org/faqs/macrosvba/SortArray.htm
or Google for "Sorting Arrays" and you will find plenty of examples.

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

 
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.