FileSystemObject : GetFolder Method


Returns a Folder object corresponding to the folder in a specified path.

Format : 

objectOfFileSystemObject. GetFolder(folderspec)

    • objectOfFileSystemObject
      • As the names says, it’s a FileSystemObject.

  • folderspec
    • Mandatory
    • Type:     String
    • Specific folder path
Function FnGetFolderList(strSpecificFolderPath)

    Set fso = CreateObject("Scripting.FileSystemObject")

    Set folder = fso.GetFolder(strSpecificFolderPath)

    Set subFolders = folder.SubFolders

    strFolders = ""

    For Each fld in subFlds

        strFolders = strFolders &

        strFolders = strFolders & " "


    FnGetFolderList= strFolders

End Function

 Msgbox FnGetFolderList (“c:\New Folder”)


You may also like...

1 Response

  1. anon says:

    For Each fld in subFlds

    Should that be subFolders?

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: