Is it at all possible to code a macro to send me an email when an error occurs detailing the fault?

Any help would be appreciated.

Thanks