Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change current directory to the directory that the workbook loads from!
Folks,
I need to accomplish a very simple thing. When I load a workbook from a directory, I need to know the directory that the workbook was loaded from and change the current directory to that directory. Most of the time the load directory turns out to be the current directory, but NOT always. My app will fail unless it knows where its related files are located. I do not want to force the user to load the workbooks in any particular directory, any directory should be OK as long as all the workbooks, documents and PowerPoint files in the app are on that same directory. My solution is convoluted and ridicules: Private Sub Workbook_Open() ChDir (Left(ActiveWorkbook.FullName, Len(ActiveWorkbook.FullName) - (Len(Dir(ActiveWorkbook.FullName))))) End Sub I am embarrassed that I cant seem to find a simple solution to this common problem - e.g.Activeworkbook.WhereAmI. There must be a better way to accomplish this than having to manipulate the ActiveWorkbook.FullName string? Thanks for your help. Allan P. London, CPA San Francisco, CA |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
current directory | Excel Discussion (Misc queries) | |||
Current Directory | Excel Discussion (Misc queries) | |||
Open Workbook in current directory | Excel Programming | |||
changing current directory to that of the current open file | Excel Programming | |||
opening a workbook in the current directory | Excel Programming |