Advanced VBA | FileDialogs exercise | Customising FileDialog box

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.

Software ==> Advanced VBA  (33 exercises)
Version ==> Any MS Office versions
Topic ==> FileDialogs  (2 exercises)
Level ==> Relatively easy
Subject ==> VBA training
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.

Create a macro to display a dialog box for choosing a file as follows:

Advanced VBA exercise - FileDialogs (image 1)

Notes on the options to set are shown below

Here are some of the things to build in:

  • The title says Choose CBeebies file
  • The default button says Choose TV file
  • There are two filters - Teletubbies (for all .txt files) and Tweenies (for all .xls files)
  • The dialog box opens with the File set 2 folder pre-selected
  • The initial view of files is as large icons

Your macro should display a suitable message if your user chooses Cancel, or this message otherwise:

Advanced VBA exercise - FileDialogs (image 2)

Display the file chosen otherwise

Save your macro file with a suitable name, then close it down.

You can unzip this file to see the answers to this exercise, although please remember this is for your personal use only.
This page has 0 threads Add post