LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Scope of 'On Error Resume Next'?

An error handler handles errors in subordinate routine if they don't have
their own error handler. When the error is encounterd, the subordinate
routine exits up to the next routine with an error handler. that is why the
last msgbox in each subordinate routine is not executed:

Sub test()
On Error Resume Next
MsgBox "test Before A err:" & Err.Number
testa
MsgBox "test After A err:" & Err.Number
testb
MsgBox "ending err:" & Err.Number
End Sub

Sub testa()
Dim rng As Range
MsgBox "In TextA Line1 err: " & Err.Number
Err.Raise 5000
MsgBox "In TestA Last Line err:" & Err.Number
End Sub

Sub testb()
Dim rng As Range
MsgBox "In TextB Line1 err: " & Err.Number
Err.Raise 6000
MsgBox "In Testb Last Line err: " & Err.Number
End Sub

--
Regards,
Tom Ogilvy

"Matt Jensen" wrote in message
...
What is the 'scope' of On Error Resume Next?
Is it for a sub, for the next line after the statement only, for a module,
or for a workbook/project?
If more than one of these, how does one specify the different ones?
Thanks
Matt




 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
On Error Resume Next Jim Sharrock Excel Programming 2 May 13th 04 03:12 PM
On error resume next statement ignored! J S Excel Programming 2 January 30th 04 10:58 PM
ON ERROR RESUME NEXT D.S.[_3_] Excel Programming 7 December 1st 03 09:40 AM
On Error Resume Next D.S.[_3_] Excel Programming 1 November 28th 03 04:52 PM
On Error Resume Next Mike[_58_] Excel Programming 3 November 23rd 03 05:09 PM


All times are GMT +1. The time now is 02:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"