Private Sub CommandButton1_Click()
On Error GoTo Err_Handle
Dim a As Integer
Dim b As Integer
Dim c As Integer
a = 10
b = 0
c = a / b '除数为0会导致运行时错误
MsgBox c
End Sub
Err_Handle:
MsgBox Err.Description
End Sub
Private Sub CommandButton1_Click()
On Error GoTo Err_Handle
Dim a As Integer
Dim b As Integer
Dim c As Integer
a = 10
b = 0
c = a / b '除数为0会导致运行时错误
MsgBox c
End Sub
Err_Handle:
MsgBox Err.Description
End Sub