Hello friends,
I am facing an issue in Excel whenever i am trying to call any sub function it is expected that the error will propagate through to error handling of
MySub. But apparently that is not happening.
Can anyone help me out with this issue.
Printable View
Hello friends,
I am facing an issue in Excel whenever i am trying to call any sub function it is expected that the error will propagate through to error handling of
MySub. But apparently that is not happening.
Can anyone help me out with this issue.
Definitely i will help you out it would be more helpful if you can provide me the code in which you are getting this error.
Here goes the code
Over here Sub1 and Sub2 do not contain any error handling but my exception was even if user gets an Error 18 and is user press Esc button he should go through error handing of MySub.Code:Private MySub()
On Error GoTo ErrTrap
Sub1
Sub2
Exit sub
ErrTrap:
If Err.Number = 18 Then
MsgBox "Error 10"
Else
MsgBox "Error 20"
End If
End
As i can see that you need to add one lince of code which you can insert it anywhere before you call the subs.
Code:Application.EnableCancelKey = xlErrorHandler