Function File Names Class

IsPathRelative

Determine if a path name is relative to the "current" directory on some drive or whether it is absolute. Function returns True if the path name is relative and False if it is absolute.

Signature (Visual Basic / VBA)

Public Function IsPathRelative( _
    ByVal vPath As Variant _
    ) As Variant

Code Example

    IsPathRelative("C:\") = False
    IsPathRelative("C:Temp") = True
    IsPathRelative("C:\Temp") = False
    IsPathRelative("C:\Temp\..\VB.Tmp") = True ' #4
    IsPathRelative("Entisoft\Temp") = True
    IsPathRelative("\Entisoft\Temp") = True
    IsPathRelative("\\SJS4\Entisoft") = False
    IsPathRelative("\\SJS4\Entisoft\Temp") = False
    IsPathRelative("\\SJS4\Entisoft\..\Temp") = False ' #9

Parameters

Parameter Description
vPath The path name that is checked to see if it is relative or absolute. Function returns Null if vPath is Null or cannot be fixed-up to a string.

Notes & Version History

Definition Absolute paths are those that specify a direct path to a file from the root of some named drive. All other path names are relative.
Note Function also considers vPath relative if it contains substrings like "\.\" or "\..\".