Auto Replace File
Posted by Thomas Venn on April 12, 2000 10:50 AM
Hi,
I have the following code:
Sub Macro1()
Workbooks.Add
ChDir "H:\15 and 17"
ActiveWorkbook.SaveAs Filename:="H:\15 and 17\Book001.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False
ActiveWindow.Close
ReplaceFile = True
Workbooks.Add
ActiveWorkbook.SaveAs Filename:="H:\15 and 17\Book002.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False
ActiveWindow.Close
End Sub
Now, when I run the macro, it gives me the message, "A file named "H:\15 and 17\Book001.xls" already exists in this location. Do you want to replace it?".
I want to replace the file everytime. I tried adding " Application.DisplayAlerts = False" to the macro, but that does not work. Please help if you can.
Thanks in advance,
Thomas