|
Private Sub CmdOK_Click()
Application.ScreenUpdating = False
Static i As Integer
If CStr(User.Value) = Right(Names("UserName").RefersTo, _
Len(Names("UserName").RefersTo) - 1) _
And CStr(Password.Value) = Right(Names("UserWard").RefersTo, _
Len(Names("UserWord").RefersTo) - 1) Then
Unload Me
Application.Visible = True
Else
i = i + 1
If i = 3 Then
MsgBox "对不起,你无权打开工作簿!", vbInformation, "提示"
ThisWorkbook.Close savechanges:=False
Else
MsgBox "输入错误,你还有" & (3 - i) & "次输入机会", vbExclamation, "提示"
User.Value = ""
Passwork.Value = ""
End If
End If
Application.ScreenUpdating = True
End Sub
|
|