Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

this code extracts the filename fro

Status
Not open for further replies.

mettodog

Vendor
Jul 11, 2000
94
US
this code extracts the filename from a filepath & name. for example, if i had C:\windows\desktop\me.html it would give me me.html. my question is, how do i use this code thought?

Public Function ExtractFileName(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
 
Lets say that you have the path held in a text1, and you want just the filename in text2.

text2 = extractfilename(text1)

David Paulson


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top