Outlook: Can't select option in combobox

Joined
Dec 3, 2013
Messages
1
Reaction score
0
I am making a custom outlook form with a 2 column combobox that is filled with my outlook contacts. The code is located in the Script Editor within Outlook. I have successfully gotten the combobox to show the contacts however when I click on a contact nothing happens.
I would expect that when I click on a contact the selection would return to the top of the combobox.
I would also expect that when I type in the typing section of the combobox it would autocomplete like it does when using the AddItem method of comboboxes. But it does not.

Has anyone else had this problem before?

I have pasted my code below, if anyone could give me some tips it would make my day! I'm sooo lost and I've tried many different codes but can't get them to work.

I have found the AddItem code works but I can't use it because I have a client base that is constantly growing and is at 800 now.

Code:
Sub Item_Open()

   Dim FullArray()

   ' Sets the name of page on the form (Activity Sheet)
   Set FormPage = Item.GetInspector.ModifiedFormPages("Activity Sheet")

   ' Sets Control to a list box called ComboBox1.
   Set Control = FormPage.Controls("ComboBox1")

   ' Get the default Contacts folder
   Set ConFolder1 = Application.Session.GetDefaultFolder(10)
   Set ConFolder2 = ConFolder1.Folders("Nswlist")

   ' Get the items in the folder
   Set ConItems = ConFolder2.Items

   ' Get the number of total items in the Contacts folder
   NumItems = ConItems.Count

   ' Resize array to handle total number of item in the folder
   ReDim FullArray(NumItems-1,2)

   ' Loop through all of the items in the Contacts folder,
   ' filling the array with sample data and keeping track
   ' of the number of contacts found.
   NumContacts = 0
   For I = 1 to NumItems
      Set itm = ConItems(I)
      If Left(itm.MessageClass, 11) = "IPM.Contact" Then
         NumContacts = NumContacts + 1
         FullArray(NumContacts-1,1) = itm.CompanyName
         FullArray(NumContacts-1,2) = itm.OrganizationalIDNumber
      End If
   Next

   ' Set the control to handle 2 data columns
   Control.ColumnCount = 3

   If NumItems = NumContacts Then
      ' They are all contacts, so use the FullArray
      Control.List() = FullArray
   Else
      ' There's some distribution lists, so use the smaller
      ' ConArray to eliminate extra blank values in the list box
      Dim ConArray()
      ReDim ConArray(NumContacts-1,2)
      For I = 0 to NumContacts - 1
         ConArray(I,1) = FullArray(I,1)
         ConArray(I,2) = FullArray(I,2)
      Next
      Control.List() = ConArray
   End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top