Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Contact us
Hide Buttons

FileSystemObject : GetFolder Method

Descrip­tion:

Returns a Folder object cor­re­spond­ing to the folder in a spec­i­fied path.

Format : 

objectOf­FileSys­te­mOb­ject. GetFolder(folderspec)

Arguments: 
    • objectOf­FileSys­te­mOb­ject
      • As the names says, it’s a FileSystemObject.

  • fold­er­spec
    • Manda­tory
    • Type:     String
    • Spe­cific 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 & fld.name

        strFolders = strFolders & " "

    Next

    FnGetFolderList= strFolders

End Function

 Msg­box FnGet­Fold­erList (“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: