Avoiding Overwrite Confirmation

  • Thread starter Thread starter Jerry Camel
  • Start date Start date
J

Jerry Camel

I've got a script that collects information and then formats it in an Excel
sheet. I wasn tthe script to save the sheet with a particular filename,
even if the old file (say, from last week's run) is still there. Is there a
way to tell Excel it's okay ot overwrite the file when I call the SaveAs
method? I don't want to require user interaction.

I'm guessing I have to look for the file first and delete it
programmatically, but it seemed like such a simple option that I wanted to
ask first, to make sure I'm not missing anything. Thanks.

Jerry
 
One way:

Wrap your code like this:

Application.DisplayAlerts = False
ThisWorkbook.SaveAs fName
Application.DisplayAlerts = True
 
That was simple enough... Thanks.

Jerry

J.E. McGimpsey said:
One way:

Wrap your code like this:

Application.DisplayAlerts = False
ThisWorkbook.SaveAs fName
Application.DisplayAlerts = True
 
Back
Top