[465.xls] ' [mjSumple] のコード '■■ システム終了前確認(「終了」or 「閉じる」クリック時) ■■ ' ' 'フォームを表示します Sub frmSumple_Show() 'フォームの表示 UserForm1.Show End Sub ' [UserForm1] のコード Private Sub cmdClose_Click() Dim intRet As Integer intRet = MsgBox("システムを終了してよろしいですか?", vbOKCancel + vbApplicationModal, "終了確認") If intRet = vbOK Then Unload UserForm1 End If End Sub Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = 0 Then intRet = MsgBox("システムを終了してよろしいですか?", vbOKCancel + vbApplicationModal, "終了確認") If intRet = vbCancel Then Cancel = 1 End If End Sub