Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
getpath in a template
Hello,
I have a template that I would like the user to use so as to not alter it other than when using it on a periodic basis (four weekly). This is hopefully to be used at 19 other sites and each will save their four weekly file to a slightly different path. Being as this is the case I have used the following code Sub saveas() getpath = ActiveWorkbook.Path ActiveWorkbook.SaveAs Filename:= _ getpath & "\Rota " & Range("A1") & ".xls" 'Where A1 is today's date End Sub However, this does not work as I want to save it to the path of the template (Rota.xlt) not the worksheet it generates (Rota1.xls) as this is not actually saved anywhere so defaults just to the top level of the hard drive. I can obviously get around this by using a workbook and not a template file and have put in protection of locking all cells and adding code in the macro above to unlock the cells. However I would still rather use the template file. Many thanks in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
getpath in a template
Once a workbook is created using a template, it has no connection to the
template. The only thing I could recommend is to use an install program to install the template and have the install program write the path of the template in the template for reference by your macro. -- Regards, Tom Ogilvy "solomon_monkey" wrote in message oups.com... Hello, I have a template that I would like the user to use so as to not alter it other than when using it on a periodic basis (four weekly). This is hopefully to be used at 19 other sites and each will save their four weekly file to a slightly different path. Being as this is the case I have used the following code Sub saveas() getpath = ActiveWorkbook.Path ActiveWorkbook.SaveAs Filename:= _ getpath & "\Rota " & Range("A1") & ".xls" 'Where A1 is today's date End Sub However, this does not work as I want to save it to the path of the template (Rota.xlt) not the worksheet it generates (Rota1.xls) as this is not actually saved anywhere so defaults just to the top level of the hard drive. I can obviously get around this by using a workbook and not a template file and have put in protection of locking all cells and adding code in the macro above to unlock the cells. However I would still rather use the template file. Many thanks in advance. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
getpath in a template
A little over my head so I think I will leave it until I have read
around a little more. Thanks ever so much for getting back though!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I distribute a template created with Template Wizard ? | Excel Discussion (Misc queries) | |||
NCAA tournament brackets template from Template gallery. | Excel Worksheet Functions | |||
Where do I find a template for a high school template? | Excel Discussion (Misc queries) | |||
I want to create a template like invoice template in excel. | Excel Programming | |||
Excel template to load automatically as the default template? | Excel Discussion (Misc queries) |