VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



ExtractFileName

by D. de Haas (4 Submissions)
Category: VB function enhancement
Compatability: Visual Basic 3.0
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating: (40 Votes)

It extracts a filename from a filepath.

Inputs
A string comtaining a valide path & filename
Assumes
Put this function in a module or the declaration section of a form in which this function is needed.
Code Returns
Returns only the filename
Side Effects
It only works with VB6, this of the function 'StrReverse' which is not in previous versions of VB

Rate ExtractFileName

Public Function ExtractFileName(ByVal strPath As String) As String
 ' StrReverse is only working in VB6
 strPath = StrReverse(strPath)
 strPath = Left(strPath, InStr(strPath, "\") - 1)
 ExtractFileName = StrReverse(strPath)
End Function

Download this snippet    Add to My Saved Code

ExtractFileName Comments

No comments have been posted about ExtractFileName. Why not be the first to post a comment about ExtractFileName.

Post your comment

Subject:
Message:
0/1000 characters