True, VBA doesn't support control arrays, however you can simulate it quite well by creating a class that acts as a container for the control object.
At run-time you can dynamically create the VBA control (ie. MyForm.Controls.Add("MSForms.OptionButton") ), pass it the resulting control object in to your class, then add the class object to a collection.
You can then iterate using a For..Each loop quite nicely, and obviously group control functionality together.
If you do this, you'd almost certainly want to declare the control WithEvents in your class so that you can expose all the normal control events, such as Click and Change.
Hope that's what you meant, anyway!
|