If the only error handler is in AAA, that error handler will be invoked by
an error in any subordinate procedure. Thus, if AAA calls BBB which calls
CCC, and an error occurs in CCC, BBB is terminated altogether is execution
passes directly from the error in CCC to the error handler in AAA. If the
error handler in AAA is Resume Next, execution returns to the line after the
call to BBB.
For example, look at the following code. AAA has the only error handler. AAA
call BBB which calls CCC which deliberately raise a DIV/0 error. Execution
goes directly from the error in CCC to the line after the call in AAA to
BBB. Therefore, the output in the Immediate window is
1 In AAA
1 In BBB
1 In CCC
2 In AAA
which clearly shows that BBB is skipped over by the error handling logic.
(If execution were to go back to BBB after the error in CCC, you'd see the
"2 In BBB" output.
Sub AAA()
On Error Resume Next
Debug.Print "1 In AAA"
BBB
Debug.Print "2 In AAA"
End Sub
Sub BBB()
Debug.Print "1 In BBB"
CCC
Debug.Print "2 In BBB"
End Sub
Sub CCC()
Debug.Print "1 In CCC"
Debug.Print 1 / 0 ' deliberately raise an error
Debug.Print "2 In CCC"
End Sub
If you did in fact put an error handler in BBB, the error in CCC would use
that error handler (because it is the most recently error handler made
active) and the code would go back to BBB, not AAA.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)