View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jake Marx[_3_] Jake Marx[_3_] is offline
external usenet poster
 
Posts: 860
Default 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]