VBA GetExtensionName

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.

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)