ExtractFileName

Syntax:

ExtractFileName(Str)

Description:
Extracts the name and extension parts of a file name. The resulting string is the rightmost characters of FileName, starting with the first character after the colon or backslash that separates the path information from the name and extension. The resulting string is equal to FileName if FileName contains no drive and folder parts.

Parameter Description

Str  A text string containing the full path from which the filename should be extracted.

Example:

Sub Main
'will return filename.txt
MsgBox ExtractFileName("c:\foldername\filename.txt")
End
Sub

See Also:

ExtractFilePath