davemcwish
New Member
- Joined
- Nov 12, 2013
- Messages
- 11
I have a Sub procedure that calls, in sequence, 5 other sub procedures:-
I currently have error handling within each of
Sub_A
Sub_B
Sub_C
Sub_D
Sub_E
identical to that shown above.
Given the dependencies, if there is an error in any of A through E I'd like error handling to manage the error as is found and then terminate (Sub Analyse) completely. Currently if I get an error in e.g. Sub_B, the local error handling deals with it and then the code continues with Sub_C.
Thoughts ?
Code:
Sub Analyse
On Error GoTo ErrHandler:
Call Sub_A
Call Sub_B (output from Sub_A)
Call Sub_C (output from Sub_B)
Call Sub_D (output from Sub_C)
Call Sub_E (output from Sub_D)
ErrHandler:
End
If Err.Number <> 0 Then
strEmailErrorText = "Runtime Error" & vbCrLf & vbCrLf & "Module: " & Application.VBE.ActiveCodePane.CodeModule.Name & vbCrLf & "Procedure: " & strProcedureName & vbCrLf & "Line: " & Erl & vbCrLf & vbCrLf & DisplayADSIError()
Call MsgBox(strEmailErrorText, vbCritical + vbSystemModal, strToolName)
Call Email_Support(strEmailErrorText)
'120 End If
End Sub
I currently have error handling within each of
Sub_A
Sub_B
Sub_C
Sub_D
Sub_E
identical to that shown above.
Given the dependencies, if there is an error in any of A through E I'd like error handling to manage the error as is found and then terminate (Sub Analyse) completely. Currently if I get an error in e.g. Sub_B, the local error handling deals with it and then the code continues with Sub_C.
Thoughts ?
Last edited: