The FileSystemObject VBA GetParentFolderName function returns the name of the parent folder of a given file or folder path.
VBA FileSystemObject Methods
- BuildPath
- CopyFile
- CopyFolder
- CreateFolder
- CreateTextFile
- DeleteFile
- DeleteFolder
- DriveExists
- FileExists
- FolderExists
- GetAbsolutePathName
- GetBaseName
- GetDrive
- GetDriveName
- GetExtensionName
- GetFile
- GetFileName
- GetFolder
- GetParentFolderName
- GetSpecialFolder
- GetTempName
- MoveFile
- MoveFolder
- OpenTextFile
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"