![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
The following code pulls in the company names of the people listed in our
contact list. Obviously we have more than one person for each company, so the list shows the company name more than once. Is there a way of filtering and returning one entry person company? Thank you. Richard ----- Function Item_Open() Dim cmbContacts Dim cmbView Dim OVCtl1 Dim IsLoading Dim RestrictedContactItems Const olFolderContacts = 10 On Error Resume Next Set cmbContacts = Item.GetInspector.ModifiedFormPages("P.2").Control s("cmbContacts") Set MyContacts = Application.GetNameSpace("MAPI").GetDefaultFolder( olFolderContacts) Set MyItems = MyContacts.Items Set RestrictedContactItems = MyItems.Restrict("[Company] ''") 'Sort by Company in ascending order RestrictedContactItems.Sort "[Company]" For Each MyItem in RestrictedContactItems cmbContacts.AddItem MyItem.CompanyName Next IsLoading = True cmbContacts.ListIndex = 0 IsLoading = False End Function |
#2
|
|||
|
|||
![]()
Add the names to a collection as you get them. Use the company name as both
the value and key for the collection item. Any dupes will error out in the collection's Add method. Just ignore the error and proceed. At the end you will have a collection of unique names. Iterate the collection to fill your drop-down. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Richard Edwards" wrote in message ... The following code pulls in the company names of the people listed in our contact list. Obviously we have more than one person for each company, so the list shows the company name more than once. Is there a way of filtering and returning one entry person company? Thank you. Richard ----- Function Item_Open() Dim cmbContacts Dim cmbView Dim OVCtl1 Dim IsLoading Dim RestrictedContactItems Const olFolderContacts = 10 On Error Resume Next Set cmbContacts = Item.GetInspector.ModifiedFormPages("P.2").Control s("cmbContacts") Set MyContacts = Application.GetNameSpace("MAPI").GetDefaultFolder( olFolderContacts) Set MyItems = MyContacts.Items Set RestrictedContactItems = MyItems.Restrict("[Company] ''") 'Sort by Company in ascending order RestrictedContactItems.Sort "[Company]" For Each MyItem in RestrictedContactItems cmbContacts.AddItem MyItem.CompanyName Next IsLoading = True cmbContacts.ListIndex = 0 IsLoading = False End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How do I set a unique signature for each profile? | Lou S. | Outlook - Installation | 1 | February 21st 06 09:33 PM |
Delete items from sent items box | Selector007 | Outlook - General Queries | 1 | February 13th 06 09:47 PM |
How to hide Read items? I want to see only the Unread Items in my view. | [email protected] | Outlook - General Queries | 3 | February 7th 06 02:56 PM |
How to display PO Box field in Business Address Box from contact | Sue Mosher [MVP-Outlook] | Outlook - Using Contacts | 0 | January 18th 06 05:01 PM |
my flagged items are not popping up in the "reminder dialog box", | Karla Camarata | Outlook - Using Contacts | 0 | January 10th 06 06:57 PM |