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) | In some suitable application (Excel, for example) create a simple subroutine to display a message. Your subroutine should take one argument - the message to be displayed - and produce output like this: | ||
You can pass different messages to your subroutine to display different message boxes
|
|||
| 2) | If you still have time, try writing a different subroutine to unprotect or protect a given worksheet. This subroutine should take 2 arguments:
|
||
|
|||
| 3) | Try running your macro using commands like this to test it: | ||
Two sample commands to test your macro
|
|||
| 4) | If you still have time, try making the second argument optional, so that by default your subroutine will protect a sheet if the protection status is not explicitly given when the macro is run. | ||
| 5) | Save this file as Examples of arguments, and close it down. | ||
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