Page 275 - Excel Progamming Weekend Crash Course
P. 275

n540629 ch19.qxd  9/2/03  9:35 AM  Page 250




                250                                                         Saturday Evening

                  The user form demonstration is complete, and you can test it by running the TestUserForm
               procedure. When you do, the form is displayed. If you click the Move button, the form shifts
               to the top right corner of the screen. Click the text box to activate it, enter some text in the
               text box, and click the Close button. The program displays a message box with the text you
               entered, showing how the VBA code can retrieve data from a user form.
                  This is a simple demonstration. Sessions 20 and 21 provide more information about user
               forms, along with examples, and Session 22 presents a couple of complete, real-world user
               form programs.



                                                   REVIEW
               This session introduced you to creating custom dialog boxes with Excel’s user forms. Some of
               the things you learned are
                   A user form can contain the same controls that are used in many other Windows
                   applications.
                   A VBA project can contain as many user forms as it needs.
                   Forms and controls have properties that specify their appearance and behavior.
                   The VBA editor provides a visual design tool that lets you create the visual interface
                   of your user forms.
                   You display a form to the user by calling its Show method in VBA code.
                   In a form’s code, you can use the Me keyword to refer to the form.



                                               QUIZ YOURSELF
                 1. Two of the three main components of a user form are the form itself and the con-
                    trols on the form. What is the third main component? (See the “Overview of User
                    Forms” section.)
                 2. What property determines the text that is displayed in the title bar of a user form?
                    (See the “Appearance Properties” section.)
                 3. The position of a user form on the screen is measured in relation to what point?
                    (See the “Behavior and Position Properties” section.)
                 4. What’s the difference between a modal form and a non-modal form? (See the
                    “Behavior and Position Properties” section.)
                 5. When your program is finished using a form, how does it destroy the form? (See
                    the “Displaying, Using, and Hiding Forms” section.)
   270   271   272   273   274   275   276   277   278   279   280