Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing default file locations

Status
Not open for further replies.

webgeeksc

Technical User
Joined
Apr 4, 2003
Messages
2
Location
US
Does anyone know of a way to change the default file location of any Office document to the directory from within where the file was opened (current directory)?

Thank you! [yinyang]
 
You can generally set this within Tools>Options>General Rgds
Geoff
"Some cause happiness wherever they go; others whenever they go."
-Oscar Wilde
 
Thanks. Yes I know that. But you have to specify a path. I want it to KNOW where I am (could be different directories at different times). I would think there would be a way to code this but I'm not sure.
 
Aaaaah - code - maybe should've asked this in the VBA forum then... Rgds
Geoff
"Some cause happiness wherever they go; others whenever they go."
-Oscar Wilde
 
I found in Excel by looking at properties of WorkBook (I think) that

ActiveWorkbook.FullName

tells you (read only) where the Workbook file is located which I put in a thread about Hyperlinks a day or two back on this forum.

The equivalent in Word or Access must be intuitively similar.
 
Word equivalent of the doc location is
ActiveDocument.FullName

However the Access equivalent is far more coplex so I gave-up after an hour. The only property I found that came close needed a lot more work it failed on read - the way I tried anyway.
 
Hi webgeeksc,

I think this is a very interesting question!

I assume you initiate the Office product via Windows Explorer, so for example Word opens with your document but the Current Folder is not aligned if you go to open another file - this time in Word. If you do a File Save As but don't save it will open at your folder, but a subsequent File Open will still open at the default folder. If you actually saved your file via the File Save As, then that would fix it, but you might not want to do that.

You need a macro which runs when the Office program is started in this way, and resets the current directory to the directory of your file.

Maybe one of our macro gurus can come up with a solution. It's well beyond my expertise!

Good Luck!

Peter Moran
Two heads are always better than one!
 
An interesting question, indeed, and the Office applications are not all the same.

For the record, the Access equivalent of ActiveDocument (or ActiveWorkbook) .Fullname is CurrentDb.Name but that may not help you much. Also for the record the Word default is changed via Tools > Options > File Locations rather than Tools > Options > General as in Excel and Access.

The default location in Word (and, I think, Excel) is application-wide and accessible, and changeable, in various ways, none of them (to me) very intuitive. The stored (in the registry) default is also not necessarily the same as the current session default. If you open your document via the Open Dialog the default location for the current session is changed to match the document; if you open a document any other way it isn't. But you can only have one default location no matter how many documents you have open, so the best course of action really depends on exactly what you want to do and in which application and it certainly involves code.

Enjoy,
Tony
 
TonyJollans
Thanks for that - I tried looking at all the properties of the most obvious candidate - with no joy.

If you name a Macro

Auto-Open in Excel and Auto_Exec (I think or Auto_Run) in Word and heavan knows what in Access it will run on open but beware people don't like them because of the Love bug virus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top