Microsoft Office Tutorials and References
In Depth Information
Inserting a New UserForm
Following is the typical sequence that you’ll follow when you create a UserForm:
Insert a new UserForm into your workbook’s VB Project.
Add controls to the UserForm.
Adjust some of the properties of the controls that you added.
Write event-handler procedures for the controls.
These procedures, which are located in the code window for the UserForm, are executed
when various events (such as a button click) occur.
Write a procedure that will display the UserForm.
This procedure will be located in a VBA module (not in the code module for the
Add a way to make it easy for the user to execute the procedure you created in Step 5.
You can add a button to a worksheet, a Ribbon command, and so on.
Inserting a New UserForm
To insert a new UserForm, activate the VBE (press Alt+F11), select your workbook’s project from
the Project window, and then choose Insert➜UserForm. UserForms have default names like
UserForm1 , UserForm2 , and so on.
You can change the name of a UserForm to make it easier to identify. Select the form
and use the Properties window to change the Name property. (Press F4 if the Properties
window isn’t displayed.) Figure 13-1 shows the Properties window when an empty
UserForm is selected.
A workbook can have any number of UserForms, and each UserForm holds a single custom
dialog box.
Search JabSto ::

Custom Search