我有一个关于在Excel中处理VBA错误的正确方法的问题。如果发生特定的错误,比如xxxxxxx,则应该显示一个MsgBox。如果发生其他错误,则应该弹出标准的运行时错误处理程序。如何实现这一点?以下是示例代码:
On Error Resume Next
'Line of code that causes an error here.
If Err.Number = xxxxxxx Then
MsgBox "Specific error message."
ElseIf Err.Number = 0 Then
Do nothing
Else 'Some error other than xxxxxxx.
'This is the problem. Here I would like to display standard run-time error
'handler without causing the error again.
End If
On Error GoTo 0