ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA- how retrieve source dir for the template *.xlt file ? (https://www.excelbanter.com/excel-programming/433167-vba-how-retrieve-source-dir-template-%2A-xlt-file.html)

Przemek[_2_]

VBA- how retrieve source dir for the template *.xlt file ?
 
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 ?



joel

VBA- how retrieve source dir for the template *.xlt file ?
 
Post the code. This is real easy to fix. You just need some minor
modification to your code.

"Przemek" wrote:

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 ?




Przemek[_2_]

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

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.




joel

VBA- how retrieve source dir for the template *.xlt file ?
 
I don't have enough info to give good reults. Give more details.

"Przemek" wrote:


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.





Przemek[_2_]

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

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.



joel

VBA- how retrieve source dir for the template *.xlt file ?
 
Create a new workbook with a macro that copies the XLT file and saves it.

"Przemek" wrote:


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.




Przemek[_2_]

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

Create a new workbook with a macro that copies the XLT file and saves it.


this is not what i'm expected. Thanks anyway.



Dave Peterson

VBA- how retrieve source dir for the template *.xlt file ?
 
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????

Przemek wrote:

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 ?


--

Dave Peterson


All times are GMT +1. The time now is 01:31 AM.

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