[RESOLVED] Getting File path from full path and name
Let's presume I've got a path as follows :
"C:\TestProjects\FilesnStuff\Test1\File0.doc"
I want to get :
"C:\TestProjects\FilesnStuff\Test1"
only, so I don't want the file name.
I tried this :
Code:
NewFName = Mid(FName, InStrRev(FName, "\") + 1) & "\Output"
If Not FoldCreated Then
MkDir NewFName
FoldCreated = True
End If
But, I got the filename?
How can I change this to get the path only??
Re: Getting File path from full path and name
You had it close.
Code:
Option Explicit
Private Sub Form_Load()
Dim str As String
Dim spath As String
str = "C:\TestProjects\FilesnStuff\Test1\File0.doc"
spath = Mid$(str, 1, InStrRev(str, "\"))
MsgBox spath
End Sub
Re: Getting File path from full path and name
Thank you sir!
Unfortunately I cannot rate you :(
Re: Getting File path from full path and name
Its ok, no prob. Just glad to help. :)