Lab 11 Creating a Dictionary

In this lab, you create a dictionary and then populate it with a list of filenames provided by the file system object.

Lab Instructions

  1. Open Notepad.exe.

  2. On the first line, type Option Explicit.

  3. Declare the following variables by using the Dim command:

    Dim objDictionary
    Dim objFSO
    Dim objFolder
    Dim colFiles
    Dim objFile
    Dim colItems
    Dim colKeys
    Dim strKey
    Dim strItem
  4. Use CreateObject to create the dictionary:

    Set objDictionary = CreateObject("Scripting.Dictionary")
  5. Create the file system object and assign it to the variable objFSO:

    Set objFSO = CreateObject("Scripting.FileSystemObject")
  6. Use the GetFolder method and assign it to the variable objFolder:

    Set objFolder = objFSO.GetFolder("C:\scriptingBook")

    Select a folder available ...

Get Microsoft® Windows® Scripting Self-Paced Learning Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.