Option Explicit
Private Sub Command1_Click()
On Error GoTo ErrLabel '打开错误陷阱
'------------------------------------------------
Dim a As Boolean
a = True
If getresult = False And 1 < 0 Then
MsgBox a
Else
MsgBox a
End If
'------------------------------------------------
Exit Sub
'----------------
ErrLabel:
'跳出错误对话框,并保存错误信息
Resume Next
End Sub
Private Function getresult() As Boolean
Err.Raise 100
End Function
Private Sub Command1_Click()
On Error GoTo ErrLabel '打开错误陷阱
'------------------------------------------------
Dim a As Boolean
a = True
If getresult = False And 1 < 0 Then
MsgBox a
Else
MsgBox a
End If
'------------------------------------------------
Exit Sub
'----------------
ErrLabel:
'跳出错误对话框,并保存错误信息
Resume Next
End Sub
Private Function getresult() As Boolean
Err.Raise 100
End Function