Rahul Aggarwal
New Member
Hello Team,
I have created a userform for login and password. below is the my code:
Private Sub CommandButton1_Click()
Dim username, Password As String
username = TextBox1.Text
Password = TextBox2.Text
If username = "myuser" And Password = "mypassword" Then
MsgBox "You entered the correct information", vbInformation
Unload Me 'unload this form
Else
MsgBox "You entered the wrong information", vbCritical
'now close the workbook
ActiveWorkbook.Close
End If
End Sub
I want different password for different username. for example if username is "Rahul" then password should be "Rahul" and if username is "Raghu" then password should be "Raghu"
Please help me how i can modify this coding to get desire result.
Your Response will greatly appreciate.
I have created a userform for login and password. below is the my code:
Private Sub CommandButton1_Click()
Dim username, Password As String
username = TextBox1.Text
Password = TextBox2.Text
If username = "myuser" And Password = "mypassword" Then
MsgBox "You entered the correct information", vbInformation
Unload Me 'unload this form
Else
MsgBox "You entered the wrong information", vbCritical
'now close the workbook
ActiveWorkbook.Close
End If
End Sub
I want different password for different username. for example if username is "Rahul" then password should be "Rahul" and if username is "Raghu" then password should be "Raghu"
Please help me how i can modify this coding to get desire result.
Your Response will greatly appreciate.