OK.. I'm a complete n00b to VBA programming. I have come to need it for a project I'm now working on, and I'm having trouble making it work. (Keep in mind that I have no formal VBA training/experience, this is purely from referencing online tutorials, etc... SO, there are likely to be a LOT of mistakes.)
What I'm trying to do is make the macros behind the form scalable. I want the code to go through and find the control name for each listbox in the form. Here's what I have so far:
***
Private Sub Blah()
Dim ctrl As Controls
Dim objectName As Object
For Each ctrl In Form.AirplanePrograms.Controls
If TypeOf ctrl Is ListBox Then
objectName = ctrl
Call ColorsUpdate(objectName)
End If
Next ctrl
End Sub
***
I don't know how to reference the name of the control. Please help! (And sorry if this is really poor code!
)
What I'm trying to do is make the macros behind the form scalable. I want the code to go through and find the control name for each listbox in the form. Here's what I have so far:
***
Private Sub Blah()
Dim ctrl As Controls
Dim objectName As Object
For Each ctrl In Form.AirplanePrograms.Controls
If TypeOf ctrl Is ListBox Then
objectName = ctrl
Call ColorsUpdate(objectName)
End If
Next ctrl
End Sub
***
I don't know how to reference the name of the control. Please help! (And sorry if this is really poor code!