"Go ahead and replace file" command?
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 |
"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 |
"Go ahead and replace file" command?
Thanks, Tom. I appreciate the help.
Ed "Tom Ogilvy" wrote in message ... 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 |
All times are GMT +1. The time now is 11:36 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com