An easy way would be to use the FileSystemObject in the Scripting
library. In VBA, go to the Tools menu, choose References, and put
a check next to "Microsoft Scripting Runtime". Then, use code
like
Dim FSO As Scripting.FileSystemObject
Dim Fldr As Scripting.Folder
Set FSO = New Scripting.FileSystemObject
Set Fldr = FSO.GetFolder(ActiveWorkbook.Path)
Set Fldr = Fldr.ParentFolder.ParentFolder
Debug.Print Fldr.Path
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"Nirmal Singh" wrote in
message ...
Given the following path:
s = Excel.ActiveWorkbook.Path
how can I find the parent folder 3 levels up?
Eg if s =
p:\paydata\hrimp\library\monthlystats\2005\12\Chie fExec
i want to be able to return
p:\paydata\hrimp\library\monthlystats
I could do it by searching for the \ characters from the end of
the
string, but it is there any easier way to do this?
Nirmal Singh