CHAPTER 15Implementing Advanced UserForm Techniques
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 that 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 the following:
UserForm1.Show vbModeless
The keyword vbModeless
is a built-in constant that has a value of 0
. Therefore, the following statement works identically:
UserForm1.Show 0
Figure 15.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.
Get Excel 2019 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.