Excel VBA Programming For Dummies, 2nd Edition
xvi
A UserForm Example ...................................................................................260
Creating the UserForm ......................................................................260
Adding the CommandButtons ..........................................................261
Adding the OptionButtons ................................................................262
Adding event-handler procedures ...................................................263
Creating a macro to display the dialog box....................................265
Making the macro available ..............................................................266
Testing the macro ..............................................................................267
Chapter 17: Using UserForm Controls. . . . . . . . . . . . . . . . . . . . . . . . . . .269
Getting Started with Dialog Box Controls .................................................269
Adding controls ..................................................................................269
Introducing control properties ........................................................270
Dialog Box Controls: The Details ...............................................................273
CheckBox control ..............................................................................274
ComboBox control .............................................................................274
CommandButton control ..................................................................275
Frame control .....................................................................................276
Image control......................................................................................276
Label control ......................................................................................277
ListBox control ...................................................................................278
MultiPage control...............................................................................279
OptionButton control ........................................................................279
RefEdit control ...................................................................................280
ScrollBar control ................................................................................281
SpinButton control ............................................................................282
TabStrip control .................................................................................282
TextBox control .................................................................................282
ToggleButton control ........................................................................283
Working with Dialog Box Controls ............................................................284
Moving and resizing controls ...........................................................284
Aligning and spacing controls ..........................................................284
Accommodating keyboard users .....................................................285
Testing a UserForm ...........................................................................287
Dialog Box Aesthetics .................................................................................287
Chapter 18: UserForm Techniques and Tricks . . . . . . . . . . . . . . . . . . .289
Using Dialog Boxes ......................................................................................289
A UserForm Example ...................................................................................289
Creating the dialog box .....................................................................290
Writing code to display the dialog box ...........................................292
Making the macro available ..............................................................292
Trying out your dialog box ...............................................................293
Adding event-handler procedures ...................................................294
Validating the data .............................................................................295
Now the dialog box works ................................................................296
02_503690-ftoc.indd xvi02_503690-ftoc.indd xvi 4/12/10 11:20 PM4/12/10 11:20 PM