ADVANCED VBA EXERCISES▼
Advanced VBA | FileSystemObjects exercise | Collating the results of a questionnaire using FileSystemObjects
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.
The folder shown above contains 43 files. Each one is the response of one region of England and Wales to an attitudes survey that you sent out:
We're particularly interested in the named range Q4Range, shown selected above.
Write a macro which loops over all of the workbooks in this folder. For each workbook, it should:
- Check if the reply to the Daily Mail question is Yes;
- If it is, write out the name of the area to the immediate window;
- Close the workbook down, without saving any changes.
Don't forget to create a reference to the Microsoft Scripting Runtime object library first!
Here's what you should get as a result of running your macro:
The first few of the 16 regions who voted to ban the Daily Mail (fighting illiberalism with illiberalism?).
Save your workbook as The Great Satan, then close it down.