ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SaveAs macro: How do I specify "Replace existing file?" (https://www.excelbanter.com/excel-programming/329948-saveas-macro-how-do-i-specify-replace-existing-file.html)

[email protected]

SaveAs macro: How do I specify "Replace existing file?"
 
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


Tom Ogilvy

SaveAs macro: How do I specify "Replace existing file?"
 
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
"C:\file.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False
Application.DisplayAlerts = True

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
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





All times are GMT +1. The time now is 11:57 AM.

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