[RESOLVED] remove filename in the path location
How I can remove the filename in the path location?
I have textbox that show the path location.
During runtime My textbox show the full path location like this
c:\project\data\block\table.dbf.
How to remove the filename so that my textbox only show me path location like this
c:\project\data\block\
any suggestion or idea?
Re: remove filename in the path location
Code:
Option Explicit
Private Sub Form_Load()
MsgBox GetDirFromFile("E:\VideoPaper\Videos\Atomic Kitten - Whole Again.mpg")
MsgBox GetPathFromFile("E:\VideoPaper\Videos\Atomic Kitten - Whole Again.mpg")
End Sub
Public Function GetDirFromFile(FileName As String) As String
'Returns "E:\VideoPaper\Videos\".
GetDirFromFile = Left(FileName, InStrRev(FileName, "\"))
End Function
Public Function GetPathFromFile(FileName As String) As String
'Returns "Atomic Kitten - Whole Again.mpg".
GetPathFromFile = Right(FileName, Len(FileName) - InStrRev(FileName, "\"))
End Function