|
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("UserWord").RefersTo, Len(Names("UserWord").RefersTo) - 1) Then
Unload denglu
Application.Visible = True
Else
i = i + 1
If i = 3 Then
MsgBox "对不起,你无权打开工作簿", vbInformation, "提示"
ThisWorkbook.Close Savechanges:=False
Else
MsgBox "输入错误,你还有" & (3 - i) & "次输入机会!", vbExclamation, "错误"
User.Value = ""
Password.Value = ""
End If
End If
Application.ScreenUpdating = True
End Sub
我按照上述代码运行后,另外我设置的user=qwer,password=123.但是就是一直登陆错误,求教这是为嘛啊?
|
|