A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Can't select option in combobox



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 28th 13, 06:30 AM
danie11e.m danie11e.m is offline
Junior Member
 
First recorded activity at Outlookbanter: Nov 2013
Posts: 1
Default Can't select option in combobox

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

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

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

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

All of the scripts I have found don't work and I've been Googling for 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 Sub
Ads
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
auto correct option under proof reading is not available to select Pattigal Outlook - Installation 1 April 14th 10 03:40 PM
Can you select more than one option in a drop down list in BCM? Meb0017 Outlook - General Queries 1 August 24th 09 01:51 PM
select ALL option Ranjit kurian Outlook and VBA 2 September 22nd 08 06:24 PM
How do I vote on a blackberry (select approve/reject option)? voter Outlook - Using Forms 0 October 18th 06 09:27 PM
No option to select ACT address book. MelissaKinVA Outlook - Installation 1 March 8th 06 06:27 PM


All times are GMT +1. The time now is 09:45 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2024 Outlook Banter.
The comments are property of their posters.