ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Accept Overwrite Automatically (https://www.excelbanter.com/excel-programming/321802-accept-overwrite-automatically.html)

Reed[_3_]

Accept Overwrite Automatically
 
Hi,

I have a file that I want to save in 2 different places so I always have an
up to date backup copy. I also want to be able to modif y either copy and
have the most current file in both places. Using the code below I get a
prompt asking if I want to overwrite the current file. Is there a way to
Accept the Overwrite Automatically?

Thanks,

Mike

ChDir "H:\"
ActiveWorkbook.SaveAs Filename:="H:\Hours.xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ChDir "H:\SX56 My Documents\Excel"
ActiveWorkbook.SaveAs Filename:="H:\SX56 My Documents\Excel\Hours.xls",
_
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False



Tom Ogilvy

Accept Overwrite Automatically
 
Application.DisplayAlerts = False
ChDir "H:\"
ActiveWorkbook.SaveAs Filename:="H:\Hours.xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ChDir "H:\SX56 My Documents\Excel"
ActiveWorkbook.SaveAs Filename:="H:\SX56 My Documents\Excel\Hours.xls",
_
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Application.DisplayAlerts = True

If you don't want to change the name of the open workbook, look at
SaveCopyAs

--
Regards,
Tom Ogilvy


"Reed" wrote in message
...
Hi,

I have a file that I want to save in 2 different places so I always have

an
up to date backup copy. I also want to be able to modif y either copy and
have the most current file in both places. Using the code below I get a
prompt asking if I want to overwrite the current file. Is there a way to
Accept the Overwrite Automatically?

Thanks,

Mike

ChDir "H:\"
ActiveWorkbook.SaveAs Filename:="H:\Hours.xls", FileFormat:=xlNormal,

_
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ChDir "H:\SX56 My Documents\Excel"
ActiveWorkbook.SaveAs Filename:="H:\SX56 My

Documents\Excel\Hours.xls",
_
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False






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

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