VBA GetParentFolderName

The FileSystemObject VBA GetParentFolderName function returns the name of the parent folder of a given file or folder path.

VBA GetParentFolderName Syntax

1
fso.GetParentFolderName( path )

path
The path of the file or folder of which you want to obtain the parent folder name.

VBA GetParentFolderName Examples

1
2
3
Set fso = CreateObject("Scripting.FileSystemObject")
 
fso.GetParentFolderName("C:\Src\Subfolder\") 'Result: "Src"