ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   path to current file... (https://www.excelbanter.com/excel-programming/308563-path-current-file.html)

daschund

path to current file...
 
All,

I'm trying to retrieve the path to the current directory from which an
Excel Template was opened.

An interesting thing is that if you use the 'New' (right-click menu
item) on an .XLT file, the 'ThisWorkbook.Path' is empty -- but, if you
save the file as an .XLS and then open that .XLS -- 'ThisWorkbook.Path'
has a value.

What I need is a way of determining the path to the directory that the
XLT resides in -- before I've saved the document as an .XLS.

Any tips/help will be greatly appreciated.

Thanks,

-D


---
Message posted from http://www.ExcelForum.com/


Jake Marx[_3_]

path to current file...
 
Hi daschund,

I'm trying to retrieve the path to the current directory from which an
Excel Template was opened.

An interesting thing is that if you use the 'New' (right-click menu
item) on an .XLT file, the 'ThisWorkbook.Path' is empty -- but, if you
save the file as an .XLS and then open that .XLS --
'ThisWorkbook.Path' has a value.

What I need is a way of determining the path to the directory that the
XLT resides in -- before I've saved the document as an .XLS.

Any tips/help will be greatly appreciated.


I don't think this is possible. When you open a new workbook based on a
template, you really are getting a new, unsaved workbook. So that workbook
does not have a Path until you save it. If the user opens the template via
Excel, you could check the CurDir$ function, which should return the correct
path. But if the file was opened outside of Excel, I think you're out of
luck.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]



All times are GMT +1. The time now is 08:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com