VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Function to Get the File name only where File name with Folder name is passed

by Raghuraja. C (21 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 17th February 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Function to Get the File name only where File name with Folder name is passed

Rate Function to Get the File name only where File name with Folder name is passed



    
    ' To get file name from file object
    On Error GoTo LOCALERRORHANDLER

    Dim intInc As Integer       'For incremental value
    Dim intPos As Integer       'For storing position

    For intInc = 1 To Len(strFileName)
        If MID(strFileName, intInc, 1) = "\" Then
            intPos = intInc
        End If
    Next
    fnGetFileName = MID(strFileName, intPos + 1)

    Exit Function
LOCALERRORHANDLER:
    fnGetFileName = ""
End Function

Download this snippet    Add to My Saved Code

Function to Get the File name only where File name with Folder name is passed Comments

No comments have been posted about Function to Get the File name only where File name with Folder name is passed. Why not be the first to post a comment about Function to Get the File name only where File name with Folder name is passed.

Post your comment

Subject:
Message:
0/1000 characters