Results 1 to 2 of 2
Thread: On Error (2003)
2008-06-26, 04:06 #1
- Join Date
- Sep 2001
- Stuck at work..., Missouri, USA
- Thanked 0 Times in 0 Posts
On Error (2003)
I have some code that is guaranteed to generate one error and possibly two.
For the first, I use <pre>On Error GoTo <my label></pre>
For the second I've tried <pre>On Error GoTo <my other label></pre>
After the first error, it goes to the first label, but when the next error gets thrown, I get an error message instead of it moving to the second label.
Is it possible to have multiple On Error GoTo statements?<font face="Comic Sans MS">Morgan Erickson</font face=comic>
<img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.
2008-06-26, 08:17 #2
- Join Date
- Mar 2002
- Thanked 28 Times in 28 Posts
Re: On Error (2003)
You can use different On Error GoTo statements, but you must take care to end each error handling section (the part starting with the label you jump to) with either Exit Sub or with one of the Resume statements (Resume, Resume Next or Resume <label>).
Another option is to let one error handler handle all errors:
On Error GoTo ErrHandler
Select Case Err