Microsoft Office
Loops and conditions exercise
Harder than average exercise

This Microsoft Office LOOPS AND CONDITIONS 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: Password system

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

1) Download the files needed to start this exercise: exercise-126.zip (and click here if you experience any problems unzipping this file after downloading it).
2) Imagine that the file shown above is highly secret (it isn't, but there you are).
3) Create a new workbook, and save this as Password answer.xls.  
4) Create a macro within this workbook which:
  • Asks you for your password up to 3 times.
  • Opens the highly secret file if you type in the correct one (it is cabbages); or
  • Ejects you from Excel if you fail to get the answer right in 3 attempts.
Training exercise hint You can use the statement Exit Sub to exit from a subroutine prematurely if the user gets the answer right, and Application.Quit to leave Excel.  You will find this exercise much easier if you write your algorithm on paper using pseudo-code first.
5) Save  this workbook and close it down.

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..