Help with Save As in a macro.

  • Thread starter Thread starter SMonczka
  • Start date Start date
S

SMonczka

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.
 
Hi

Before the SaveAs like add this

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

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
Save as marco 3
Save As File Format 1
SaveAs to existing file 5
Save with ref. to cell A1 2
Saving a workbook to an iKnow portal 2
Recording a 'Save As...' 4
Enable/Disable Macro 2

Back
Top