14.2. Creating a Custom Dialog Box

VBA uses visual objects called user forms to implement dialog boxes. A user form (also sometimes referred to as a form) is a blank sheet on which you can place controls (such as check boxes and buttons) to create a dialog box.

The user form contains a code sheet that holds code attached to the controls in the form: you can attach code to any of the controls and to the user form itself, and that code is stored in the user form's code sheet. You can display the user form's code sheet in the Code window of the Visual Basic Editor and work with it as you would any other code. You can run the user form as you would a procedure (for example, by pressing F5 with the user form selected), and the Visual Basic Editor ...

Get Mastering VBA for Microsoft Office 2007, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.