Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If MsgBox("确认退出吗?", vbQuestion + vbYesNo + vbDefaultButton2, "提示") = vbNo Then Cancel = -1 End If
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If MsgBox("是否退出", vbYesNo) = vbNo Then Cancel = 1 End If End Sub
If MsgBox("确认退出吗?", vbQuestion + vbYesNo + vbDefaultButton2, "提示") = vbNo Then
Cancel = -1
End If
End Sub
If MsgBox("是否退出", vbYesNo) = vbNo Then
Cancel = 1
End If
End Sub
cancel 一个整数。将此参数设定为除 0 以外的任何值,可在所有已装载的窗体中停止 QueryUnload 事件,并阻止该窗体和应用程序的关闭。