Tools Links Login

ExtractFileName

It extracts a filename from a filepath.

Original Author: D. de Haas

Inputs

A string comtaining a valide path & filename

Assumptions

Put this function in a module or the declaration section of a form in which this function is needed.

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

Code

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

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 86 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.