![]() |
How to prevent error message during macro
I have a simple macro to Save-As the workbook. If the workbook already
exists where its suppose to save to, then naturally a dialog box comes up asking if I want to overwrite the file. If the user clicks NO, then run-time erorr 1006 comes up "Method 'Save-As' of object '_ workbook' failed." Can I add code to just ignore the error and continue on? Thanks, J.O. |
How to prevent error message during macro
Use the DisplayAlerts property to suppress warning messages.
E.g., Application.DisplayAlerts = False ThisWorkbook.SaveAs "H:\Book2.xls" Application.DisplayAlerts = True -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "excelnut1954" wrote in message ups.com... I have a simple macro to Save-As the workbook. If the workbook already exists where its suppose to save to, then naturally a dialog box comes up asking if I want to overwrite the file. If the user clicks NO, then run-time erorr 1006 comes up "Method 'Save-As' of object '_ workbook' failed." Can I add code to just ignore the error and continue on? Thanks, J.O. |
How to prevent error message during macro
On Error Resume Next
' current code On Error goto 0 I would include the minimum number of lines of code between these two commands as necessary - otherwise you can mask real errors. -- Regards, Tom Ogilvy "excelnut1954" wrote: I have a simple macro to Save-As the workbook. If the workbook already exists where its suppose to save to, then naturally a dialog box comes up asking if I want to overwrite the file. If the user clicks NO, then run-time erorr 1006 comes up "Method 'Save-As' of object '_ workbook' failed." Can I add code to just ignore the error and continue on? Thanks, J.O. |
How to prevent error message during macro
Thanks guys. Always appreciate the help.
J.O. |
All times are GMT +1. The time now is 03:10 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com