Creating custom dialog boxes

Anyone who has used a personal computer for any length of time is undoubtedly familiar with dialog boxes. Consequently, custom Excel dialog boxes play a major role in the user interfaces that you design for your applications.

Excel 97 introduced a completely new way to create custom dialog boxes: UserForms. However, subsequent versions still support Excel 5/95 dialog sheets.This book focuses exclusively on UserForms.

You can use a custom dialog box to solicit user input, get a user's options or preferences, and direct the flow of your entire application. Custom dialog boxes are stored in UserForms (one dialog box per UserForm). You create and edit custom dialog boxes in the VBE, which you access by pressing Alt+F11. The elements that make up a dialog box (buttons, drop-down lists, check boxes, and so on) are called controls — more specifically, ActiveX controls. Excel provides a standard assortment of ActiveX controls, and you can also incorporate third-party controls.

After adding a control to a dialog box, you can link it to a worksheet cell so that it doesn't require any macros (except a simple macro to display the dialog box). Linking a control to a cell is easy, but it's not always the best way to get user input from a dialog box. Most of the time, you'll want to develop VBA macros that work with your custom dialog boxes.

I cover UserForms in detail in Part IV.

I cover UserForms in detail in Part IV.

Was this article helpful?

0 -1


Post a comment