Be the first user to complete this post

  • 0
Add to List

FileSystemObject : GetParentFolderName Method

Description: 

Returns the parent folder name.

Format : 

objectOfFileSystemObject. GetParentFolderName(filepath)

  • objectOfFileSystemObject : As the name says, it’s a FileSystemObject.
Arguments: 
  • filepath
    • Mandatory
    • Type:     String
    • File path for which Parent Folder is to be return.

Function FnGetParentFolderName (strSpecificFilePath)

    Set fso = CreateObject("Scripting.FileSystemObject")

    strParentFolderName = fso. GetParentFolderName(strSpecificFilePath)    FnGetParentFolderName = strParentFolderName

End Function

Msgbox  FnGetParentFolderName ("c:\New Folder\file.txt")



Also Read:

  1. FileSystemObject : GetAbsolutePathName Method
  2. FileSystemObject : DriveExists Method
  3. FileSystemObject : GetFolder Method
  4. FileSystemObject:OpenTextFile Method
  5. Excel-VBA : Insert Multiple Images from a Folder to Excel Cells