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

fso.GetExtensionName( path )

The path for which the file extension is supposed to be specified.

VBA GetExtensionName Examples

Set fso = CreateObject("Scripting.FileSystemObject")

fso.GetExtensionName ("C:\Src\Hello.txt") 'Result: "txt"

fso.GetExtensionName ("C:\Src") 'Result: "" (null string)