Chapter 13: Advanced UserForm Techniques

In This Chapter

• Using modeless UserForms

• Displaying a progress indicator

• Creating a wizard — an interactive series of dialog boxes

• Creating a function that emulates VBA's MsgBox function

• Allowing users to move UserForm controls

• Displaying a UserForm with no title bar

• Simulating a toolbar with a Userform

• Emulating a task pane with a Userform

• Allowing users to resize a UserForm

• Handling multiple controls with a single event handler

• Using a dialog box to select a color

• Displaying a chart in a UserForm

• Using an Enhanced Data Form

• Creating a moving tile puzzle

A Modeless Dialog Box

Most dialog boxes that you encounter are modal dialog boxes, which you must dismiss from the screen before the user can do anything with the underlying application. Some dialog boxes, however, are modeless, which means the user can continue to work in the application while the dialog box is displayed.

To display a modeless UserForm, use a statement such as

UserForm1.Show vbModeless

The word vbModeless is a built-in constant that has a value of 0. Therefore, the following statement works identically:

UserForm1.Show 0

Figure 13-1 shows a modeless dialog box that displays information about the active cell. When the dialog box is displayed, the user is free to move the cell cursor, activate other sheets, and perform other Excel actions. The information displayed in the dialog box changes when the active cell changes.

Figure 13-1: This modeless ...

Get Excel 2013 Power Programming with VBA now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.