GetFileName method
Returns the last component of a specified path that is not part of the drive specification.
Syntax
object.GetFileName (pathspec)
The GetFileName method syntax has these parts:
Part | Description |
---|---|
object | Required. Always the name of a FileSystemObject. |
pathspec | Required. The path (absolute or relative) to a specific file. |
Remarks
The GetFileName method returns a zero-length string ("") if pathspec does not end with the named component.
Note
The GetFileName method works only on the provided path string. It does not attempt to resolve the path, nor does it check for the existence of the specified path.
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.