Page 22 - Excel Progamming Weekend Crash Course
P. 22
540629 FM.qxd 9/2/03 4:10 PM Page xix
Contents xix
SESSION 23–Working with Events ..............................................................295
Event Categories .................................................................................295
Event Handler Code .............................................................................296
Event Sequences .................................................................................297
Enabling and Disabling Events ..............................................................297
Workbook Events ................................................................................298
The Open Event ................................................................................299
The NewSheet Event ..........................................................................300
Worksheet Events ...............................................................................300
The Change Event .............................................................................301
Using the Change Event for Data Validation .............................................301
Application Events ..............................................................................303
Writing Application Event Procedures ....................................................304
The WorkbookBeforeClose Event ...........................................................305
Other Events ......................................................................................306
The OnTime Event .............................................................................307
The OnKey Event ..............................................................................308
SESSION 24–Security Considerations ..........................................................311
Workbook Protection ...........................................................................311
Worksheet Protection ..........................................................................312
VBA Code and Worksheet Protection ......................................................314
Protecting the Loan Calculator Worksheet ...............................................315
Protecting Your VBA Code ....................................................................315
Macro Security ...................................................................................316
Adding a Trusted Source .....................................................................317
Removing a Trusted Source .................................................................317
Using Digital Certificates to Sign Macros .................................................317
SESSION 25–Debugging and Distributing an Application ..............................321
Debugging an Application ....................................................................321
What Are Bugs? ................................................................................321
Avoiding Bugs ..................................................................................322
Debugging Tools ...............................................................................323
Breakpoints .................................................................................323
Step Commands ............................................................................324
Using Watches ..............................................................................325
Using Quick Watches ......................................................................327
Distributing an Application ..................................................................327
SESSION 26–Defining and Using Custom Classes .........................................329
Class Fundamentals .............................................................................329
The Advantages of Classes ....................................................................330
Instantiating Classes ...........................................................................330
Class Properties ..................................................................................331
Creating Property Procedures ...............................................................331
The Property Variable ........................................................................332