View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default "Go ahead and replace file" command?

Yes,
Application.DisplayAlerts = False

will allow you to overwrite the file without prompt.

Another approach is to Kill any existing file before doing the saveas

fName = "C:\Myfolder\Myfile.xls"
On Error Resume Next
Kill fName
On Error goto 0
Thisworkbook.SaveAs fName

--
Regards,
Tom Ogilvy

"Ed" wrote in message
...
I need to create a file and SaveAs a file with the same name. Will the
Alerts = False automatically tell it "Yes, replace the other file with the
same name"? Or is there another line I should add to the SaveAs code to
tell Excel to overwrite and replace the existing file?

Thanks.
Ed