Microsoft Office Tutorials and References
In Depth Information
Chapter 19
Creating User Forms
Creating a UserForm . . . . . . . . . . . . . . . 395
UserForm Controls . . . . . . . . . . . . . . . . . 401
User forms give Microsoft Excel programmers the opportunity to provide a different way for
users to interact with their applications. In this chapter, you’ll learn how to create a form and
populate it with the standard controls supplied by Microsoft Visual Basic for Applications
(VBA). Then you’ll learn how to display and close forms from your own routines. Finally,
you’ll learn how to interact with the form from your VBA application.
Creating a UserForm
Visual Basic for Applications includes a special object known as a UserForm . A UserForm
object provides a visible surface on which you can place graphical controls, such as buttons,
images, and text areas.
Adding a UserForm
You can add a UserForm to your project by choosing Insert, UserForm from the Visual Basic
Editor. (See Figure 19-1.) The user form consists of mockup of a window, including a title bar
complete with the title UserForm1 and a Close button, plus a drawing surface filled with dots.
In addition to displaying the user form, the Visual Basic Editor also displays a floating toolbar
called the To olbox . The Toolbox contains various controls that can be placed on the drawing
surface of the user form.
Search JabSto ::

Custom Search