Accept Overwrite Automatically

  • Thread starter Thread starter Reed
  • Start date Start date
R

Reed

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
 
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
 
Back
Top