In many cases you may need the canonical (or absolute) name of a file, for example when you need to compare two relative file names (relative to the current directory or drive, that is) and decide whether they point to the same or different files.
You can obtain the canonical path of a file using an API call, but the FileSystemObject object offers a better and simpler way:
' NOTE: this code requires that you add a reference to the' Microsoft Scripting Runtime type libraryFunction GetAbsolutePath(ByVal FileName As String) As String Dim fso As New Scripting.FileSystemObject GetAbsolutePath = fso.GetAbsolutePathName(FileName)End Function