The FileSystemObject VBA GetExtensionName function returns a string with the file extension of a given file path. Will return a null string (vbNullString) if no extension is found or the path does not match a file.
- 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 GetExtensionName Syntax
1 | fso.GetExtensionName( path ) |
path
The path for which the file extension is supposed to be specified.
VBA GetExtensionName Examples
1 2 3 4 5 | Set fso = CreateObject( "Scripting.FileSystemObject" ) fso.GetExtensionName ( "C:\Src\Hello.txt" ) 'Result: "txt" fso.GetExtensionName ( "C:\Src" ) 'Result: "" (null string) |