此宏的目的是检查首页上的用户名和密码是否与订阅特定人员的密码匹配,以查看它是否匹配,然后在“员工工资”表上植入用户名和密码无限期。
我遇到的麻烦就是阻止有人更改已经种植的用户名和密码我无论如何都会锁定单元格,这似乎会阻止宏工作,因为它说如果它们被锁定就无法更改单元格。
我可以使用其他方法来防止冲突吗?
Sub PASSWORD_CHECK()
Application.Worksheets("Front sheet").Range("B24").Formula = ("=VLOOKUP(D4,Lock!R:T,1,FALSE)") ' looks up school name
Application.Worksheets("Front sheet").Range("B25").Formula = ("=EXACT(B24, D4)") ' validation of school name
Application.Worksheets("Front sheet").Range("B26").Formula = ("=VLOOKUP(D4,Lock!R3:T106,3,FALSE)") ' looks up password
Application.Worksheets("Front sheet").Range("B27").Formula = ("=EXACT(B26,D6)") ' validates password
Application.Worksheets("Front sheet").Range("B29").Formula = ("=IF(AND(B25,B27),1,0)") ' checks to validate both school and pasword
Application.Worksheets("Front sheet").Range("B32").Formula = ("=IF(B27=B25,1,0)") ' Checks to see if password belongs to school
Dim A As String
Dim B As String
Dim C As Boolean
Dim D As String
Dim E As String
Dim F As Boolean
A = Worksheets("Staff Salaries").Range("P3")
B = Worksheets("Staff Salaries").Range("N2")
C = Worksheets("Front sheet").Range("B29")
D = Worksheets("Front sheet").Range("D4")
E = Worksheets("Front sheet").Range("D6")
F = Worksheets("Front sheet").Range("B32")
If C = "TRUE" And F = "TRUE" Then ' All OK
Worksheets("Staff Salaries").Range("N2") = D
Worksheets("Staff Salaries").Range("P3") = E
Else
MsgBox ("PASSWORD IS INCONSISTANT WITH USER")
End If
End Sub
答案 0 :(得分:1)
试试这个:
readonly EmployeeServiceClient _employeeService = new EmployeeServiceClient();
readonly AuthenticationServiceClient _authenticationService = new AuthenticationServiceClient();
Employee authedEmployee = _authenticationService.Authenticate();
Employee test = _employeeService.Get(827);