In Microsoft's help for adding an item to a ComboBox they show an example(see below) where you pass the ComboBox as an object to a function. Unfortunately they do not show the code calling this function and when I try and do it I get an error. Has anybody managed to do this?
This example adds an item to the beginning of the list in a combo box control. For the function to work, you must pass it a ComboBox object representing a combo box control on a form and a String value representing the text of the item to be added.
Function AddItemToBeginning(ctrlComboBox As ComboBox, _
ByVal strItem As String)
ctrlComboBox.AddItem Item:=strItem, Index:=0
End Function
This example adds an item to the beginning of the list in a combo box control. For the function to work, you must pass it a ComboBox object representing a combo box control on a form and a String value representing the text of the item to be added.
Function AddItemToBeginning(ctrlComboBox As ComboBox, _
ByVal strItem As String)
ctrlComboBox.AddItem Item:=strItem, Index:=0
End Function