Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I distribute a template created with Template Wizard ? Sofia Excel Discussion (Misc queries) 0 June 20th 07 04:51 PM
NCAA tournament brackets template from Template gallery. smcclements Excel Worksheet Functions 2 March 16th 07 02:33 PM
Where do I find a template for a high school template? pluspoola Excel Discussion (Misc queries) 0 July 1st 05 02:35 AM
I want to create a template like invoice template in excel. Rahul Gupta[_2_] Excel Programming 7 May 12th 05 02:50 AM
Excel template to load automatically as the default template? David Excel Discussion (Misc queries) 1 March 21st 05 12:24 PM


All times are GMT +1. The time now is 07:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"