Rayne
asked on
VBA This - File location but not file
Hello,
I have a variable that stores a file path like this
fileLoc = "C:\Here\There\myFile.xls"
Now what splitting or anything I need to do to parse out the file name out of that string and retrun me only string without the filename like this
filLoc now becomes "C:\Here\There"
what to do in VBA? if I want the strign like this from a full file path...
Thanks
I have a variable that stores a file path like this
fileLoc = "C:\Here\There\myFile.xls"
Now what splitting or anything I need to do to parse out the file name out of that string and retrun me only string without the filename like this
filLoc now becomes "C:\Here\There"
what to do in VBA? if I want the strign like this from a full file path...
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you Martin, that works Gold :)
You're welcome and I'm glad I was able to help.
Marty - MVP 2009 to 2013
Marty - MVP 2009 to 2013
intPos = InStrRev(fileLoc, "\")
MsgBox Left(fileLoc, intPos - 1)