Microsoft Office Tutorials and References
In Depth Information
To summarize the difference between Unload and Hide , the method you choose
will depend on why you don’t want the UserForm to be seen. Most of the time,
you’ll want the form cleared from memory, but sometimes, information that was
entered into the form needs to be referred to the next time you show the form
while the workbook has remained open. Closing the workbook automatically
unloads a UserForm only if it was hidden.
In this lesson, you design a simple UserForm with a Label control, a TextBox control, a CheckBox
control, and two CommandButton controls.
For this lesson, you practice designing a simple UserForm with various controls to emulate a client
profile. To get the sample database files you can download Lesson 18 from the book’s website at
Press Alt+F11 to go to the Visual Basic Editor.
Select the workbook name in the Project Explorer window, and from the menu at the top of
the VBE click Insert ➪ UserForm.
Select the UserForm in its design window, and press the F4 key (or click View ➪ Properties
Window) to show the Properties window.
Change the Name property to frmClients and change the Caption property to Clients .
Size the UserForm by setting its Height property to 240 and its Width property to 190.
From the menu at the top of the VBE, click View ➪ Toolbox.
From the Toolbox, click the Label control icon and draw a Label across the top of the
UserForm. With the Label control selected, change its Caption property to Company Name .
From the Toolbox, click the TextBox control icon and draw a TextBox directly below the
From the Toolbox, click the Label control icon again, and draw a Label a little bit below the
TextBox. With that Label control selected, change its Caption property to Client’s business
— check all that apply: .
Directly below the Label from Step 9, from the Toolbox, click the CheckBox control
icon and draw a CheckBox that is wide enough for you to have its caption property be