Procedures that Act on a Group of Controls

You can use the almost-forgotten ability of Visual Basic to have a function or sub with an undeterminednumber of arguments do something to a set of controls. For example, you can enable/disable many controlswith one sub call:

 EnableAll True, Text1, Text2, _        Command1, Command2

This procedure iterates on all the controls passed as arguments:

 Sub EnableAll(Enabled As Boolean, _        ParamArray objs() As Variant)                Dim obj As Variant                For Each obj In objs                        obj.Enabled = Enabled                Next objEnd Sub
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: