View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
J.E. McGimpsey J.E. McGimpsey is offline
external usenet poster
 
Posts: 493
Default Avoiding Overwrite Confirmation

One way:

Wrap your code like this:

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


In article ,
"Jerry Camel" wrote:

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