Hello,
I have created an excel sheet which have two textboxes "username" and "password" as a login system. I did not use the visual basic form to design. I have only insert 2 textboxes on the sheet and a picture as a login. if i click the picture it should login. its checking the password and the usernames from a table.
I have completed the code. however, it is giving me an error when compiling it.
one note, my textbox is an activex control
Thank you!
I have created an excel sheet which have two textboxes "username" and "password" as a login system. I did not use the visual basic form to design. I have only insert 2 textboxes on the sheet and a picture as a login. if i click the picture it should login. its checking the password and the usernames from a table.
I have completed the code. however, it is giving me an error when compiling it.
one note, my textbox is an activex control
VBA Code:
Sub PLSLOGIN_CLICK()
Dim wsAdmin As Worksheet
Dim inputusername As String
Dim inputPassword As String
Dim userLookupResult As Variant
Dim passwordLookupResult As Variant
Set wsAdmin = Worksheets("ADMIN")
inputusername = Worksheets("LOGIN").TextBoxes("txtUsername").Value /////// the erorr is"Unable to get the Textboxes property of the worksheet class"
inputPassword = Worksheets("LOGIN").TextBoxes("txtPassword").Value
userLookupResult = Application.VLookup(inputusername, wsAdmin.ListObjects("tblAcess").DataBodyRange, 1, False)
passwordLookupResult = Application.VLookup(inputusername, wsAdmin.ListObjects("tblAcess").DataBodyRange, 2, False)
If Not IsError(userLookupResult) And Not IsError(passwordLookupResult) Then
If passwordLookupResult = inputPassword Then
Call Login
Else
'Bad Login
MsgBox "Login Failed!"
End If
Else
'Bad Login
MsgBox "Login Failed!"
End If
End Sub
Thank you!