Page 427 - Microsoft Office Excel 2003 Programming Inside Out
P. 427

Part 5:  Manipulating Excel Objects
                                                      Creating User Forms

                    UserForm Controls

                             The toolbox contains a useful assortment of controls that can be placed on a form. Some,   Chapter 19
                             like the Label control, are static and merely modify how the form appears. Other controls,
                             such as the TextBox and the CommandButton, interact with the user to edit information and
                             trigger tasks.


                    Programming Controls
                             In addition to displaying the form, the Visual Basic Editor also displays a floating toolbar
                             called the toolbox. The toolbox contains the list of controls that can be placed on a form.
                             To add a control to the form, select the control from the toolbox, drag it onto the form, and
                             drop it where you want the control. You can adjust the size and placement of the control
                             graphically by selecting the control and dragging the control around or by dragging the box
                             that surrounds the control. (See Figure 19-2.)





























                             Figure 19-2.  You add controls to a form control by selecting a control and dragging and drop-
                             ping it on the form.

                             All of the code associated with the form and its controls are stored in the form module.
                             This is an independent element much like a regular module or a class module. Double-click­
                             ing a control will switch you from the graphical view of the form to the code view of the form
                             and automatically insert the subroutine definition for the default event for that control.






                                                                                                       401
   422   423   424   425   426   427   428   429   430   431   432