VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Function to retrieve only file name from a path.

by C.J. (13 Submissions)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Originally Published: Sat 2nd January 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Function to retrieve only file name from a path.

Rate Function to retrieve only file name from a path.



'Parses the filename out of a directory string
     
     Dim i As Integer
     
     On Error Resume Next
     
     For i = Len(FileName) To 1 Step -1
       If Mid(FileName, i, 1) = "\" Then
         Exit For
       End If
     Next
     
     GetFileName = Mid(FileName, i + 1)

End Function

Download this snippet    Add to My Saved Code

Function to retrieve only file name from a path. Comments

No comments have been posted about Function to retrieve only file name from a path.. Why not be the first to post a comment about Function to retrieve only file name from a path..

Post your comment

Subject:
Message:
0/1000 characters