Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If MsgBox("你真的要退出吗?", vbOKCancel, "提示") = vbCancel Then Cancel = True End If End Sub