Gets only the file name from a file path.
Gets only the file name from a file path.
Rate Gets only the file name from a file path.
(1(1 Vote))
Dim i As Long
For i = 1 To Len(FileName)
If Left(Right(FileName, i), 1) = "\" Then
If WithSlash = False Then
FileNameOnlyFromFullPath = Right(FileName, i - 1)
Else
FileNameOnlyFromFullPath = Right(FileName, i)
End If
Exit Function
End If
Next
End Function
---=== How to Use ===---
' To get the file name with the slash at the left
variable = FileNameOnlyFromFullPath(FILENAME, True)
' To get the file name without the slash at the left
variable = FileNameOnlyFromFullPath(FILENAME, False)
Gets only the file name from a file path. Comments
No comments yet — be the first to post one!
Post a Comment