path to current file...

D

daschund

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
 
J

Jake Marx

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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top