getpath in a template

S

solomon_monkey

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.
 
T

Tom Ogilvy

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.
 
S

solomon_monkey

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!!
 

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