O'Reilly logo

Excel® 2007 Power Programming with VBA by John Walkenbach

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 13. Introducing UserForms

In This Chapter

Excel makes it relatively easy to create custom dialog boxes for your applications. In fact, you can duplicate the look and feel of many of Excel’s dialog boxes. This chapter provides an introduction to and overview of UserForms.

  • Creating, showing, and unloading UserForms

  • A discussion of the UserForm controls available to you

  • Setting the properties of UserForm controls

  • Controlling UserForms with VBA procedures

  • A hands-on example of creating a UserForm

  • An introduction to the types of events relevant to UserForms and controls

  • Customizing your control Toolbox

  • A handy checklist for creating UserForms

Excel developers have always had the ability to create custom dialog boxes for their applications. Beginning with Excel 97, things changed substantially — UserForms replaced the clunky old dialog sheets. You’ll find that UserForms are much easier to work with, and they offer many additional capabilities. Even though UserForms have not been upgraded over the years, you’ll find that this feature works well and is very flexible.

How Excel Handles Custom Dialog Boxes

A custom dialog box is created on a UserForm, and you access UserForms in the Visual Basic Editor (VBE).

Following is the typical sequence that you will follow when you create a UserForm:

  1. Insert a new UserForm into your workbook’s VB Project.

  2. Write a procedure that will display the UserForm. This procedure will be located in a VBA module (not in the code module for the UserForm).

  3. Add controls to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required