[014.xls] ' [mjSumple] のコード '■■ モジュール定数に設定した情報でログインする ■■ ' Option Explicit Const strUserID = "123" '←任意のUserIDを設定 Const strPass = "abc" '← 〃 Passを設定(ブック保護に使用したものと同じにして下さい) Sub psFormShow() frmLogin.Show End Sub Sub psLogin() Dim intRet As Integer With frmLogin If .txtID.Text = strUserID And .txtPass = strPass Then ActiveWorkbook.Unprotect (strPass) Sheets("Sheet1").Visible = True Sheets("Sheet1").Select Unload frmLogin Else intRet = MsgBox("ログインに失敗しました", vbExclamation, "エラー") End If End With End Sub ' [frmLogin] のコード Private Sub cmdLogin_Click() Call psLogin End Sub