|
楼主 |
发表于 2016-7-22 08:02
|
显示全部楼层
RE: 按照书例写个登入界面,结果原档打不开了
本帖最后由 DXJ_DHX 于 2016-7-22 13:55 编辑
附档在username里面执行界面放了很久,居然又回到了EXCEL档,但输了用户/密码,总是跑到密码错误的语句里面
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
applicaation.Visible = True
Else
i = i + 1
If i = 3 Then
MsgBox "对不起,你无权打开工作簿!", vbInformation, "提示"
ThisWorkbook.Close savechanges:=False
Else
MsgBox "输入错误,你还有" & (3 - i) & "次机会!", vbEXClation, "提示"
User.Value = ""
PassWord.Value = ""
End If
End If
Application.ScreenUpdating = True
End Sub
|
|