ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with Save As in a macro. (https://www.excelbanter.com/excel-programming/317445-help-save-macro.html)

SMonczka

Help with Save As in a macro.
 
I am trying to set up a macro to save a back up of a file before
making changes to the file. When I try to back up the file by saving
it over the existing file I get a prompt asking me if I want to
overwrite the old file, wich I do. But I want the macro to do this
automaticly without promting the user. Is there any way to do this?
Is there a switch to automaticly overwrite an existing file?

Here is a copy of the code so far...

ChDir "Z:\DIV4\Dept12\Dept12 Customer Service\Backup"
ActiveWorkbook.SaveAs Filename:= _
"Z:\DIV4\Dept12\Dept12 Customer Service\Backup\!Dept12
CustServ Data Center.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ChDir "Z:\DIV4\Dept12\Dept12 Customer Service"
ActiveWorkbook.SaveAs Filename:= _
"Z:\DIV4\Dept12\Dept12 Customer Service\!Dept12 CustServ Data
Center.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False


Thanks
Steve M.

Ron de Bruin

Help with Save As in a macro.
 
Hi

Before the SaveAs like add this

Application.DisplayAlerts = False
And after it
Application.DisplayAlerts = true


--
Regards Ron de Bruin
http://www.rondebruin.nl


"SMonczka" wrote in message om...
I am trying to set up a macro to save a back up of a file before
making changes to the file. When I try to back up the file by saving
it over the existing file I get a prompt asking me if I want to
overwrite the old file, wich I do. But I want the macro to do this
automaticly without promting the user. Is there any way to do this?
Is there a switch to automaticly overwrite an existing file?

Here is a copy of the code so far...

ChDir "Z:\DIV4\Dept12\Dept12 Customer Service\Backup"
ActiveWorkbook.SaveAs Filename:= _
"Z:\DIV4\Dept12\Dept12 Customer Service\Backup\!Dept12
CustServ Data Center.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ChDir "Z:\DIV4\Dept12\Dept12 Customer Service"
ActiveWorkbook.SaveAs Filename:= _
"Z:\DIV4\Dept12\Dept12 Customer Service\!Dept12 CustServ Data
Center.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False


Thanks
Steve M.





All times are GMT +1. The time now is 09:43 PM.

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