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 156 | Next

Jim DeMarco

"Pro Excel 2007 VBA"

Click OK
and enter a phone number, and then check one or more of the check boxes. Click Save.
CHAPTER 4 n USERFORMS 147
Figure 4-9. The UserForm showing the next ID available
Figure 4-10. cCustSurvey class validation result
The success message, shown in Figure 4-11, is displayed to the user, and row 5 now contains
the data we entered on our UserForm. Notice that the ID label has been updated to show
the ID for the next record.
CHAPTER 4 n USERFORMS 148
Figure 4-11. Success message and new record displayed
Let??™s test the New button before we move on to a more advanced UserForm. Clicking the
New button with a blank or empty screen does nothing. If check boxes are checked but the
text fields are empty, it will clear the screen without a prompt (this is because only the text
fields are required). Enter a state and/or phone number and click the New button, and you??™ll
receive a warning that the data has not been saved (as shown in Figure 4-12).
Figure 4-12.Warning the user about unsaved data
Clicking No returns the user to the form without making any changes. Clicking Yes will
clear the form for new entry.
CHAPTER 4 n USERFORMS 149
We made a useful addition to our cExcelUtils class. Let??™s export that file (overwriting the
existing copy) so we can use that new functionality in other projects.
1. In the VBE Project Explorer, right-click any item in the project tree.
2. Choose Export File, as shown in Figure 4-13.
Figure 4-13. Exporting a module
3. Navigate to wherever you store your *.


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