Hi all,

I have a sub which I want to call to fill a combobox. But it doesn't work. Here's the code:
---------------------------
Sub AddListItems(cmbname As ComboBox)

Dim sTemp As String
cmbname.Clear

Open (App.Path & "\list.txt") For Input As #1
While Not EOF(1)
Line Input #1, sTemp
cmbname.AddItem sTemp
Wend
Close #1

End Sub
----------------------------

For example when the combobox I want to fill is named cmbStuff, I would call it AddListItems (cmbStuff)

It should work right? But it doesn't. It gives me type mismatch.

If I replace the line
"Sub AddListItems(cmbname As ComboBox)"
with
"Sub AddListItems"
and change all the "cmbname" with "cmbStuff" in the above code, and call the simply by AddListItems, it works FINE.

Where is my mistake? Thanks in advance for any help.

Martin