Function to return filepath given full filename
Excellent suggestion - but as written that gives the filename. For the path
I think you meant:
p = InStrRev(sStr, "\")
sPath = IIf(p 0, Left(sStr, p), "")
--
Regards,
Tom Ogilvy
"Harlan Grove" wrote in message
...
"Tom Ogilvy" wrote...
...
If you have excel 2000 or later, you can use split to get the filename
sStr = "C:\Myfolder1\myfolder2\myfile.xls"
v = (sStr,"\")
sPath = Left(sStr,len(sStr)-v(ubound(v)))
...
If OP has XL2K or later, OP could use InStrRev.
p = InStrRev(sStr, "\")
sPath = IIf(p 0, Mid(sStr, p + 1), "")
|