|
各位,请问一下,我用VBA做了个登录系统,1.我想做一个,用户登录修改表日志的操作记录。请问,怎么做?
2.我想在工作表调用这个登录的用户名,谁登录显示谁名。请问怎么 做。谢谢。
下面是用户登录表的代码:
Private Sub CommandButton1_Click()
Dim MyLoginStatus As Single
MyLoginStatus = 0
For i = 2 To ThisWorkbook.Sheets("UserLoginInfor").UsedRange.Rows.Count
If (Trim(ThisWorkbook.Sheets("UserLoginInfor").Cells(i, 1).Value)) = Trim(TextBox1.Value) And (Trim(ThisWorkbook.Sheets("UserLoginInfor").Cells(i, 2).Value)) = Trim(TextBox2.Value) Then
MyLoginStatus = MyLoginStatus + 1
If (Trim(ThisWorkbook.Sheets("UserLoginInfor").Cells(i, 3).Value) = "超级管理") Then
ThisWorkbook.Sheets("UserLoginInfor").Visible = True
Else
ThisWorkbook.Sheets("UserLoginInfor").Visible = False
End If
End If
Next i
If (MyLoginStatus >= 1) Then
UserForm1.Hide
Application.Visible = True
Else
MsgBox "错误的用户名和密码", vbCritical, "系统消息"
End If
End Sub
Private Sub CommandButton1_Enter()
CreateObject("WScript.Shell").SendKeys "{enter}"
End Sub
Private Sub CommandButton2_Click()
Application.Quit
End Sub
Private Sub Label1_Click()
End Sub
Private Sub Label2_Click()
End Sub
Private Sub TextBox1_Change()
End Sub
Private Sub TextBox2_Change()
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Application.Quit
End Sub
|
|