One thing - How can I get the Last Folder name in the path?
I mean,
In the path
___________myPath = "C:\new folder\pro\"
I want to get
___________myFolder = "pro"
Private Sub Command1_Click()
Dim MyPath As String
Dim arrFolder() As String
MyPath = "C:\new folder\pro"
arrFolder = Split(MyPath, "\")
MsgBox arrFolder(UBound(arrFolder))
End Sub
dim pathparts() as string
pathparts = split(mypath, "\")
if pathparts(ubound(pathparts)) <> "" then
msgbox pathparts(ubound(pathparts))
else
msgbox pathparts(ubound(pathparts)-1)
end if
edit: looks like hack beat me, but i am not sure if you will get an empty array element thanks to your trailing slash, so my code went ahead and assumed you did.
Last edited by Lord Orwell; Aug 14th, 2007 at 02:54 PM.
Reason: fixed code tag