MrExcel Publishing
Your One Stop for Excel Tips & Solutions

SaveAs Question

Posted by Jonathan on September 17, 2001 7:07 AM

In the reports that I am running I am generating a report from a template. I want the template to remain as is so I have written into the code a "SaveAs" statement. My probelm is, if I run the report twice, when it comes to the "SaveAs", I get the Excel message box asking do I want to over write. If I say "No" then it errors out. Is there a way to make it continue running even if I say no to the overwrite question? Thanks.

Posted by Dan Liu on September 17, 2001 7:41 AM

You can put the following in you script:

excelApp.DisplayAlerts = False

This will turn off the message box, and the file will be automatically overwritten.

Hope it helps. / dan