VBA GetParentFolderName

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

VBA GetParentFolderName Syntax

fso.GetParentFolderName( path )

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

VBA GetParentFolderName Examples

Set fso = CreateObject("Scripting.FileSystemObject")

fso.GetParentFolderName("C:\Src\Subfolder\") 'Result: "Src"