Click to See Complete Forum and Search --> : Error Handling
XinMan
Jan 17th, 2000, 05:28 AM
I'm trying to implement error handling in my program. I don't want to have to put "On Error Goto ErrorHandler" in every sub or function. It becomes tedious! Does anyone know any other way around this?
TIA,
XinMan
X_Darknight_X
Jan 17th, 2000, 05:33 AM
I don't think there is away around that one. In order for every procedure to become error handled, you must have the On Error statment at the top of each one.
But I may be wrong....
------------------
David Underwood
Cannabatech Corporation
ICQ - 14028049 (http://www.icq.com/14028049)
E-mail - darknight23@hotmail.com
Try putting it in the Declarations (Dont know if it'll work ;)) section but according to MSDN you will need it for every procedure.
Glenn Harwood
MartinLiss
Jan 17th, 2000, 08:53 AM
Yes, every routine that needs error handling needs to have its own On Error Goto... statement. Have you ever just copied an existing routine and just changed it to suit your needs (leaving the On Error... of course)?
------------------
Marty
ivyl
Jan 17th, 2000, 05:37 PM
I've noticed that if you have a sub/function with an error handling routine and from that sub call another sub the error handler is still active which means that the sub you called don't need any error handling.
Crazy D
Jan 17th, 2000, 06:13 PM
True, and it depends on what kind of function it is if it needs error handling....
and yes, it would be very kewl if you could add a line in the declarations like
On Error Goto errorhandlersub
and that that sub gets called when an error occured.. including function name of course that got the error :-)
but until then, the best i can come up with is write an addin which will add error handling to every sub and function..
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.