Help with save as coed

P

Paul B

We are in the process of upgrading computers at my work, windows xp and
excel 2003, I am trying to get a macro to save the workbook as a template,
with windows 98 it saved to the same place, but with windows xp it looks
like it is getting the computers name as part of the save, the code below
was recorded on two of the computers ,is there anyway to write a macro that
will work on all the computers? Most of the people here have a limited
experience with excel and this file needs to be saved as a template after
they have put in there setup data, so I was wanting to put a button on the
sheet to save it as a template, put a shortcut on the desktop and delete
this button, I have code for the shortcut and to delete the button, but I
don’t know how to make it so the save will work on all of the computers.
Thanks

Paul B


Sub Macro1()
ChDir "C:\Documents and Settings\electric\Application
Data\Microsoft\Templates"
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\electric\Application
Data\Microsoft\Templates\Time Sheet.xlt" _
, FileFormat:=xlTemplate, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub

Sub Macro2()
ChDir _
"C:\Documents and Settings\carpentry\Application
Data\Microsoft\Templates"
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\carpentry\Application
Data\Microsoft\Templates\Time Sheet.xlt" _
, FileFormat:=xlTemplate, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub
 
J

Jim Rech

If you want to save the active workbook as a template to the same location
as the active workbook you might try code like this:

ActiveWorkbook.SaveAs Replace(ActiveWorkbook.FullName, ".xls", ""),
xlTemplate

--
Jim Rech
Excel MVP
| We are in the process of upgrading computers at my work, windows xp and
| excel 2003, I am trying to get a macro to save the workbook as a template,
| with windows 98 it saved to the same place, but with windows xp it looks
| like it is getting the computers name as part of the save, the code below
| was recorded on two of the computers ,is there anyway to write a macro
that
| will work on all the computers? Most of the people here have a limited
| experience with excel and this file needs to be saved as a template after
| they have put in there setup data, so I was wanting to put a button on the
| sheet to save it as a template, put a shortcut on the desktop and delete
| this button, I have code for the shortcut and to delete the button, but I
| don’t know how to make it so the save will work on all of the computers.
| Thanks
|
| Paul B
|
|
| Sub Macro1()
| ChDir "C:\Documents and Settings\electric\Application
| Data\Microsoft\Templates"
| ActiveWorkbook.SaveAs Filename:= _
| "C:\Documents and Settings\electric\Application
| Data\Microsoft\Templates\Time Sheet.xlt" _
| , FileFormat:=xlTemplate, Password:="", WriteResPassword:="", _
| ReadOnlyRecommended:=False, CreateBackup:=False
| End Sub
|
| Sub Macro2()
| ChDir _
| "C:\Documents and Settings\carpentry\Application
| Data\Microsoft\Templates"
| ActiveWorkbook.SaveAs Filename:= _
| "C:\Documents and Settings\carpentry\Application
| Data\Microsoft\Templates\Time Sheet.xlt" _
| , FileFormat:=xlTemplate, Password:="", WriteResPassword:="", _
| ReadOnlyRecommended:=False, CreateBackup:=False
| End Sub
|
|
 

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

Similar Threads


Top