View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
solomon_monkey solomon_monkey is offline
external usenet poster
 
Posts: 22
Default 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.