Accept Overwrite Automatically

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
 
T

Tom Ogilvy

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
 

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

Simplify save code 11
Saving a workbook to an iKnow portal 2
SaveAs to existing file 5
Hiding an Excel file using VBA 1
Save as marco 3
Save As File Format 1
Save with ref. to cell A1 2
Enable/Disable Macro 2

Top