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)