I am going over all control elemtens in my form and want to passt all ListBoxes to another function. The Code looks like this:
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.ControlType = acListBox Then
Save (ctl)
End If
Next ctl
Private Sub Save(list As ListBox)
'Do something with list
End Sub
It gives me 424 Runtime Error, telling me that an object is needed.
When I try to use
Save (ctl.Object)
I'll get an 2455 Runtime Error.
EDIT: I also tryed casting the ctl Control Object to a ListBox Object with
Dim list As ListBox
Set list = ctl
Then it tells me the same as in my first example (Error 424)