Microsoft Developer
Event handling exercise
Average difficulty

This Microsoft Developer EVENT HANDLING exercise is provided to allow potential course delegates to assess their suitability for the Wise Owl EXCEL VISUAL BASIC course only, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.

Exercise: Event-handling macros

A full answer to this exercise is provided as part of the training course!

1) Create and assign a macro so that it displays the following message when you try to close its file down:
Exercise screen-shot 182 You may need to delete the macro to close your file down!
2) Create a macro which displays the following message when you click on cell B3 (note that the Address property of a cell gives its address in absolute format - eg $B$3):
Exercise screen-shot 183 Beware - the address property is case-sensitive too!
3) Create a macro which displays the following message before you double-click (you can use VbCrLf twice in succession within your message box to create the new lines):
Exercise screen-shot 184 Not that polite really ...
4) Create a macro which displays the following message when you try to open its file:
Exercise screen-shot 185 The message which appears when you open a file
Training exercise hint Note that strictly speaking this is impossible, as you can not interrupt the Open event.  Instead, issue the command ActiveWorkbook.Close immediately after the file opens - your user will never see the difference!
5) Create a macro which immediately deletes any new worksheet you create, with the following message:
Exercise screen-shot 186 If you know his phone number, please include this also.
6) Save and close any workbooks you have created (if you can!).

Thank you for showing an interest in this Excel Visual Basic 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.

All content copyright Wise Owl Business Solutions Ltd 2008.  All rights reserved..