SaveAs macro: How do I specify "Replace existing file?"

P

pierrelap

Hello,

I have an excel macro that saves under a specific name everyday. I DO
want to replace that file when I save it.

How do I tell the SaveAs to overwrite the previous file?

Here's my code.

ActiveWorkbook.SaveAs Filename:= _
"C:\file.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False

I have to use SaveAs and not Save because my macro Copies/Pastes as
value before saving under another name.

Thanks
 
T

Tom Ogilvy

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
"C:\file.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False
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

Top