VBA- how retrieve source dir for the template *.xlt file ?

P

Przemek

welcome.


I have a template file test.xlt existing in some dir other than excel
templates dir.
When the file is launched new workbook is created and i want to autosave it
in a dir
where the test.xlt file exists.
Due to fact that instance of the file test.xlt does not longer exists i cant
get source dir.

I would be thankful for any hint.

PS.
i have used a tip that every single file launched makes its mark in a
windows recent directory,
so i found a link file (test.xlt.lnk) but a dont know how to retrieve target
dir from it.
Maybe this way ?
 
J

Joel

Post the code. This is real easy to fix. You just need some minor
modification to your code.
 
P

Przemek

Post the code. This is real easy to fix. You just need some minor
modification to your code.

Just tell me where to use and what methode/property.

I've tested the problem with empty test.xlt file with no code.
 
P

Przemek

I don't have enough info to give good reults. Give more details.

the template file test.xlt HAS NO CODE, i cant give U more details bcoz
there are no details.

after launching XLT file it creates a copy of itself named "test1.xls".
Thats how template files works.
Unfortunately this copy of xlt file isnt saved,
and i need to save it into a directory where the source file "xlt" exists.

But the problem is "how to obtain the source dir".

PS.
Just create an EMPTY *.xlt file. Close Excel. And double click on the
created file.
U will se what i'm talkin ab.
 
D

Dave Peterson

Excel doesn't keep track of where the original template was located.

If you're creating the file based on that template in code, you could keep track
of it yourself.

If you're creating the file based on that template manually, you'll have to find
another way--maybe add a name (and hide it) to the template file that specifies
the path????
 

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