WISE OWL EXERCISES
EXCEL VBA MACROS EXERCISES
Excel VBA Macros | Event handling exercise | Write a macro to log whenever anyone saves a file
This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.
You can learn how to do this exercise if you attend one of more of the courses listed below!
You need a minimum screen resolution of about 700 pixels width to see our exercises. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.
Open the workbook in the above folder. It contains a hidden sheet called Save log:
The hidden sheet contains a record of who has saved changes to the workbook, and when.
Attach a macro to an event for the workbook which adds another line to this hidden worksheet whenever anyone saves the file. Here's what you can use for the two bits of data:
|A - Date and time||Now||The current date and time|
|B - Author||Environ("UserName")||The logged-on user name|
You may need to unhide the worksheet before writing to it, and you should certainly hide it again when you've finished.
When you've finished, save your file with the same name (this should write another line to the log sheet!), then close it down.