quick help: get folder name
The reason there are two is in case you get a path like C:\Program
Files\Office\Excel.exe, or another like C:\Jim.xls. Papou's solution uses
FileSystemObject, and whilst it should work in most instances, I do know
that some organisations don't allow scripting, so it is possible that it
wouldn't work.
--
HTH
Bob Phillips
(remove xxx from email address if mailing direct)
"yo" wrote in message
oups.com...
With ActiveWorkbook
iPos = InStrRev(.Path, "\")
-- If iPos 1 Then
sFolder = Right(.Path, Len(.Path) - iPos)
Else
iPos = InStrRev(.Path, ":")
-- End If
If iPos 1 Then sFolder = Right(.Path, Len(.Path) - iPos)
End With
MsgBox sFolder
--
HTH
Bob Phillips
Hi Bob, it's working great, but i don't understand, why 2 instances of
sFolder = Right(.Path, Len(.Path) - iPos)? i took out the 1st
if...then, and it still works. can you elaborate further on this?
Papou: it's working too, and it's simple! but if someone else use this
macro on other computers, will it still works? will they have to enable
this ms scripting runtime option?
Thanks guys
|