|
- Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
- If KeyCode = 13 Then
- Dim UserID$, password$, r As Byte
- UserID = ComboBox1.Text
- password = TextBox1.Text
- Set sht = Worksheets("username")
- r = sht.Range("A2:A" & sht.[A65535].End(3).Row).Find(UserID, , , xlWhole).Row
- If sht.Cells(r, "B").Text <> password Then
- TextBox1.Text = ""
- MsgBox "密码不正确"
- TextBox1.SetFocus
- Else
- Unload User
- Worksheets("主界面").Activate
- Call 隐藏主界面元素
- Call 更新铜价
- Application.Visible = True
- End If
- KeyCode = 0
- End If
- End Sub
复制代码 用这个代码回车登陆 |
|