This Microsoft Excel GOOD PROGRAMMING TECHNIQUES exercise is provided to allow potential course delegates to assess their suitability for the Wise Owl ADVANCED VISUAL BASIC FOR APPLICATIONS course only, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.
A full answer to this exercise is provided as part of the training course!
| 1) | Download the files needed to start this exercise: exercise-612.zip (and click here if you experience any problems unzipping this file after downloading it). |
| 2) | Create an enumeration to hold the possible department ids: |
If your trainer has forgotten to tell you what an enumeration is, tell him/her off!
|
|
| 3) | Write a macro to add a new person to your database. You can assume that each person is in the Accounts department, which means setting the DepartmentId field to Department.Accounts. You can ignore the Address field). The macro should have two arguments:
|
| 4) | Test that your macro works by calling it from either the immediate window or from another subroutine to add the following people:
|
| 5) | Amend your subroutine so that, optionally, you can specify an extra argument giving the postcode. This should default to NOT SET if not specified. Call this amended subroutine to add the following people:
|
| 6) | If you have time, amend your macro so that you can also pass in (optionally) the department, which again defaults to Accounts: |
This is how you might call your amended subroutine
|
|
| 7) | Save this module and close the database. |
Thank you for showing an interest in this Advanced Visual Basic for Applications training course! As mentioned above, full answers to this and other exercises are provided on the course. On all Wise Owl scheduled courses delegates can take away these model answers (together with their own efforts!) on a free USB stick.
Recommended sites: C# corner | Computer tutorials | Training classes