PDA

View Full Version : Workbook Path - minus one folder



pcsparky
02-06-2009, 11:12 AM
I can get the current workbook path using:

wbPath = ThisWorkbook.Path

Let's say that it is C:\Documents and Settings\Work\Current\practice.xls

I want to be able to remove whatever the file name and last folder name is to just leave:

C:\Documents and Settings\Work\

It would be better if it worked regardless of how many letters are in the last folder name and file name.

Thanks if you can help.

Bob Phillips
02-06-2009, 11:53 AM
wbpath = ThisWorkbook.Path

MsgBox Left$(wbpath, InStrRev(wbpath, "\") )

pcsparky
02-06-2009, 12:39 PM
Brilliant. Could never have worked that out myself.

Thanks very much XLD