UserForm Techniques and Tricks
In This Chapter
Using a custom dialog box in your application
Creating a dialog box: a hands-on example
The previous chapters show you how to insert a UserForm (which contains a custom dialog box), add controls to the UserForm, and adjust some of the control’s properties. These skills, however, won’t do you much good unless you understand how to make use of UserForms in your VBA code. This chapter provides these missing details and presents some useful techniques and tricks in the process.
Using Dialog Boxes
When you use a custom dialog box in your application, you normally write VBA code that does the following:
Initializes the UserForm controls. For example, you may write code that sets the default values for the controls.
Displays the dialog box by using the UserForm object’s Show method.
Responds to the events that occur for the various controls — such as clicking a CommandButton.
Validates the information provided by the user (if the ...