CodeItBetter Programming Another VB Programming Blog

How to get file name alone from a file name with its full path

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
'File/Folder Handling - How to get file name alone from a file name with its full path
Public Function ExtractFileName(ByVal strFileName As String)
    Dim intPos As Integer
    intPos = InStrRev(strFileName, "\")
    ExtractFileName = Right$(strFileName, Len(strFileName) - intPos)
End Function
 
'How can I use this function:
'Debug.Print ExtractFileName("C:\Temp\Test.txt")
'will return "Test.txt"
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.