Adding Controls to a User Form at Design Time

If you've spent any time developing UserForms, you probably know that it can be quite tedious to add and adjust the controls so that they're aligned and sized consistently. Even if you take full advantage of the VBE formatting commands, it can still take a considerable amount of time to get the controls to look just right.

The UserForm shown in Figure 28-7 contains 100 CommandButtons, all of which are identical in size and positioned precisely on the form. Furthermore, each CommandButton has its own event handler procedure. Adding these buttons manually and creating their event handlers would take some time — lots of time. Adding them automatically at design time by using a VBA procedure takes about three seconds.

Figure 28-7: A VBA procedure added the CommandButtons on this UserForm.
0 0

Post a comment