View Single Post
  #1  
Old October 30th 08, 07:41 PM posted to microsoft.public.outlook.program_vba
cinnamngrl
external usenet poster
 
Posts: 28
Default What is wrong with drop-down box?

I have been trying to create a userform with a simple dropdown combo
box. I have tried to follow the examples I have found and I just
plain pasted the example for combobox2 from the help file.

Below is the code for userform dropkids with two combo boxs and
matching command buttons.


Sub CommandButton1_Click()
ComboBox1.DropDown
End Sub

Sub Item_Open()

Set olApp = New Outlook.Application
Set olns = olApp.GetNamespace("MAPI")
Set contactsFolder = olns.GetDefaultFolder(olFolderContacts)
Set allcontactitems = contactsFolder.Items
Set kids = allcontactitems.Restrict("[Categories]= ""caseload""")
kids.Sort "[LastName]"
Debug.Print kids.Count
For Each itm In kids
Debug.Print itm
ComboBox1.AddItem itm.FileAs
Next
End Sub

Sub CommandButton2_Click()
ComboBox2.DropDown
End Sub

Sub Item_OpenA()

ComboBox2.AddItem "Turkey"
ComboBox2.AddItem "Chicken"
ComboBox2.AddItem "Duck"
ComboBox2.AddItem "Goose"
ComboBox2.AddItem "Grouse"
End Sub

Private Sub UserForm_Click()

End Sub


If someone just pointed me to some no-fail sample code that would be
great!
Ads