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.

The answer to the exercise will be included and explained if you attend the course listed below!

Software ==> Advanced VBA  (33 exercises)
Version ==> Any MS Office versions
Topic ==> FileSystemObjects  (4 exercises)
Level ==> Average difficulty
Course ==> Advanced VBA
Before you can do this exercise, you'll need to download and unzip this file (if you have any problems doing this, click here for help).

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:

Daily Mail answer

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:

  1. Check if the reply to the Daily Mail question is Yes;
  2. If it is, write out the name of the area to the immediate window;
  3. 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:

Daily Mail

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.

This page has 0 threads Add post