SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 158 | Next

Jim DeMarco

"Pro Excel 2007 VBA"

Open the VBE and add a new UserForm.
2. Set the form??™s height to 320 and its width to 332.
3. Rename the formto HRWizard.
4. Add a Label to the top of the form, set its caption property to MyCompany - HR Wizard,
and set the font to a large size like 18 pt. This will be the main heading for
our form.
5. Add a MultiPage control to the form.
6. Set its Height property to 216 and its Width property to 270.
7. Center it on the form, leaving room at the bottom.
Your formin Design view should look something like Figure 4-20.
CHAPTER 4 n USERFORMS 152
Figure 4-20. Initial layout for HRWizard UserForm
Since we have four data collection sections, we need to add two additional pages to our
MultiPage control.
1. Right-click either of the tabs at the top of the MultiPage control to display the shortcut
menu.
2. Select New Page from the shortcut menu, as shown in Figure 4-21.
3. Repeat this one more time.
Figure 4-21. Inserting a new page in the MultiPage control
Your UserForm in Design view should look like Figure 4-22.
CHAPTER 4 n USERFORMS 153
Figure 4-22. UserForm after adding two new pages
Adding Controls to the Form
The following sections will explain how to add the various controls to your form.
The Personal Information Page
Add controls to Page1 of the MultiPage control as listed in Table 4-3. These will correspond to
the personal information column headings on the EmpData worksheet.
Table 4-3. HRWizard UserForm Controls
Item/Property Value
Label ??”
Caption: First Name
TextBox ??”
Name: txtFname
Label ??”
Caption: Mid Init
TextBox ??”
Name: txtMidInit
Label ??”
Caption: Last Name
TextBox ??”
Name: txtLname
Label ??”
Caption: Date of Birth
CHAPTER 4 n USERFORMS 154
Item/Property Value
TextBox ??”
Name: txtDOB
Label ??”
Caption: SSN
TextBox ??”
Name: txtSSN
Label ??”
Caption: Department
ComboBox ??”
Name: cboDept
Label ??”
Caption: Job Title
TextBox ??”
Name: txtJobTitle
Label ??”
Caption: E-mail Address
TextBox ??”
Name: txtEmail
Resize the MultiPage control so there is room on the bottom of the UserForm for two
command buttons (side by side) on the left side of the form and two command buttons (side
by side) on the right side of the form.


Pages:
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170