|
各位老师们好;
《别怕。。。》书中,285页 6.6.3一个简易的登录窗体中,“确定”的代码不能运行,不知道是怎么回事?请老师们帮忙!谢谢!
代码是这样的,如下:
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 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 = ""
Password.Value = ""
End If
End If
Application.ScreenUpdating = True
End Sub
|
|