Why does the code need to be in a module? How many constituent controls are there on the Usercontrol?
For that you'd probably have to make your own control collection although that wouldn't be difficult.
You could either pass the controls collection as an object:
VB Code:
'in module Public Sub PassCol(obj As Object) Dim ctrls As Object Set ctrls = obj Dim ctrl As Control For Each ctrl In ctrls MsgBox ctrl.Name Next End Sub 'in usercontrol PassCol Controls
Or if you don't want to use the generic object then put all the controls in your own collection:
VB Code:
'in module Public Sub PassCol(col As Collection) Dim ctrls As Collection Set ctrls = col MsgBox ctrls.Count End Sub 'in usercontrol Dim col As New Collection Dim ctrl As Control For Each ctrl In Controls col.Add ctrl Next PassCol col




Reply With Quote