Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
I'm trying to have my spreadsheet automatically close, without saving, upon an error. Any idea on how to do this? Thanks! -- Robert |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The code
ThisWorkbook.Close SaveChanges:=False will close the workbook that contains the code without doing a save. How to trigger that code, and what you mean by "upon an error", isn't at all clear. What type of error would you want to intercept? Any VBA runtime error? Thinking more about this, I would recommend that you not try to do something like this. There are many, many different errors that may arise in a workbook, and I suspect that you really only want to act upon a very small subset of possible errors. It would be very easy to lose a great deal of work with such a blunt approach. -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "robs3131" wrote in message ... Hi all, I'm trying to have my spreadsheet automatically close, without saving, upon an error. Any idea on how to do this? Thanks! -- Robert |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the code Chip. I'll take your input into consideration.
-- Robert "Chip Pearson" wrote: The code ThisWorkbook.Close SaveChanges:=False will close the workbook that contains the code without doing a save. How to trigger that code, and what you mean by "upon an error", isn't at all clear. What type of error would you want to intercept? Any VBA runtime error? Thinking more about this, I would recommend that you not try to do something like this. There are many, many different errors that may arise in a workbook, and I suspect that you really only want to act upon a very small subset of possible errors. It would be very easy to lose a great deal of work with such a blunt approach. -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "robs3131" wrote in message ... Hi all, I'm trying to have my spreadsheet automatically close, without saving, upon an error. Any idea on how to do this? Thanks! -- Robert |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Cannot close a workbook in VBA due to Run-Time error '1004' | Excel Programming | |||
Workbook close error | Excel Programming | |||
commandbar at workbook before close - run time error | Excel Programming | |||
commandbar at workbook before close - run time error | Excel Programming | |||
When running workbook.close True Excel generates an error!!! | Excel Programming |