ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Save as marco (https://www.excelbanter.com/excel-programming/428493-save-marco.html)

John

Save as marco
 
I am trying to create a macro that will first save the file and then second
save as to a new location and new file name.

Here is what I have and it doesn't work after the first save.

Sub autosave()
ActiveWorkbook.Save
ChDir "R:\"
ActiveWorkbook.SaveAs Filename:="R:\Service.xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
End Sub

I tried it with and without the ChDir "R:\" and that did not work either.

I also tried just

ActiveWorkbook.SaveAs Filename:="R:\Service.xls"

and that also did not work.

Thank you for any and all help.

Jacob Skaria

Save as marco
 
Try changing your path to c:\temp ...and if that is working. check the folder
rights in R:\

Sub autosave()
Dim strFileName as String
strFileName = "R:\service.xls"
ActiveWorkbook.Save
ActiveWorkbook.SaveAs Filename:=strFileName
End Sub


--
If this post helps click Yes
---------------
Jacob Skaria


"John" wrote:

I am trying to create a macro that will first save the file and then second
save as to a new location and new file name.

Here is what I have and it doesn't work after the first save.

Sub autosave()
ActiveWorkbook.Save
ChDir "R:\"
ActiveWorkbook.SaveAs Filename:="R:\Service.xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
End Sub

I tried it with and without the ChDir "R:\" and that did not work either.

I also tried just

ActiveWorkbook.SaveAs Filename:="R:\Service.xls"

and that also did not work.

Thank you for any and all help.


John

Save as marco
 
I changed the path to "C:\temp\servive.xls" and it still did not work.

I keep getting the code exexution has been interrupted box

"Jacob Skaria" wrote:

Try changing your path to c:\temp ...and if that is working. check the folder
rights in R:\

Sub autosave()
Dim strFileName as String
strFileName = "R:\service.xls"
ActiveWorkbook.Save
ActiveWorkbook.SaveAs Filename:=strFileName
End Sub


--
If this post helps click Yes
---------------
Jacob Skaria


"John" wrote:

I am trying to create a macro that will first save the file and then second
save as to a new location and new file name.

Here is what I have and it doesn't work after the first save.

Sub autosave()
ActiveWorkbook.Save
ChDir "R:\"
ActiveWorkbook.SaveAs Filename:="R:\Service.xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
End Sub

I tried it with and without the ChDir "R:\" and that did not work either.

I also tried just

ActiveWorkbook.SaveAs Filename:="R:\Service.xls"

and that also did not work.

Thank you for any and all help.


Jacob Skaria

Save as marco
 
You must be trying with a read-only file. Ignore save and go with Save As

'ActiveWorkbook.Save
ActiveWorkbook.SaveAs Filename:=strFileName


--
If this post helps click Yes
---------------
Jacob Skaria


"John" wrote:

I changed the path to "C:\temp\servive.xls" and it still did not work.

I keep getting the code exexution has been interrupted box

"Jacob Skaria" wrote:

Try changing your path to c:\temp ...and if that is working. check the folder
rights in R:\

Sub autosave()
Dim strFileName as String
strFileName = "R:\service.xls"
ActiveWorkbook.Save
ActiveWorkbook.SaveAs Filename:=strFileName
End Sub


--
If this post helps click Yes
---------------
Jacob Skaria


"John" wrote:

I am trying to create a macro that will first save the file and then second
save as to a new location and new file name.

Here is what I have and it doesn't work after the first save.

Sub autosave()
ActiveWorkbook.Save
ChDir "R:\"
ActiveWorkbook.SaveAs Filename:="R:\Service.xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
End Sub

I tried it with and without the ChDir "R:\" and that did not work either.

I also tried just

ActiveWorkbook.SaveAs Filename:="R:\Service.xls"

and that also did not work.

Thank you for any and all help.



All times are GMT +1. The time now is 04:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com