Can't select option in combobox

D

danie11e.m

This is the first time I have tried writing code or script of any sor
so I need all the help I can get!

I have a 2 column combobox which I have gotten to display all of m
outlook contact's full name and organisation id number successfully.

However I cannot select a contact from the combobox and autocomplet
doesn't work.

Is this is because I need to assign a value? I have made a field in th
properties tab of the combobox called Specifiers2 if that helps wit
setting the value.

All of the scripts I have found don't work and I've been Googling fo
days now.

Here is my code which is located in Outlook's Script Editor:

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 Su
 

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