The error trapping works like this... Private Sub SubRoutine On Error Goto Label Do Do Do Do Doh! On Error Goto 0 Exit Sub ' Ok, we've done our job here, let's get out Label: Doh: There was an Error!!! Your in trouble, you have the right to remain silent, anything you say can and will be used agaist you the court of law........ blah, blah, blah, now do somthing about it! 'Show a message box, or somthing, anything but what caused the error......... MsgBox "Error!!!!!!","Hey, dummy.......you can't to that" End Sub Now what will happen is, if an error occurs between On Error Goto Label, and On Error Goto 0, the the program will immedietely jump to label. Once it makes it past The On Error Goto 0, now if an error occurs, execution of the program will stop, and you will be promped with the error.
Jabstract: Don't just imagine, make it happen!
|