Hi folks,
Thank you for you support.
I have search in google i find below from this sit(https://www.datanumen.com/blogs/create-login-window-protect-excel-workbook/)
but it not suitable for me. Because of have 30 users and this code very long and user login not recode so. Please help me this Marco
Private Sub CommandButton1_Click()
If TextBox1.Value = "" Then
If TextBox2.Value = "" Then
MsgBox "Please Input the User Name and the Password"
Else
MsgBox "Please Input the User Name"
End If
ElseIf TextBox1.Value = "Admin" Then
If TextBox2.Value = "" Then
MsgBox "Please Input the Password"
ElseIf TextBox2.Value = "123" Then
Me.Hide: Application.Visible = True
Else
MsgBox "Please Input the right User Name and the right Password"
End If
Else
If TextBox2.Value = "" Then
MsgBox "Please Input the Password"
Else
MsgBox "Please Input the right User Name and the right Password"
End If
End If
End Sub
Private Sub CommandButton2_Click()
ThisWorkbook.Application.Quit
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
ThisWorkbook.Application.Quit
End Sub
Thank you for you support.
I have search in google i find below from this sit(https://www.datanumen.com/blogs/create-login-window-protect-excel-workbook/)
but it not suitable for me. Because of have 30 users and this code very long and user login not recode so. Please help me this Marco
Private Sub CommandButton1_Click()
If TextBox1.Value = "" Then
If TextBox2.Value = "" Then
MsgBox "Please Input the User Name and the Password"
Else
MsgBox "Please Input the User Name"
End If
ElseIf TextBox1.Value = "Admin" Then
If TextBox2.Value = "" Then
MsgBox "Please Input the Password"
ElseIf TextBox2.Value = "123" Then
Me.Hide: Application.Visible = True
Else
MsgBox "Please Input the right User Name and the right Password"
End If
Else
If TextBox2.Value = "" Then
MsgBox "Please Input the Password"
Else
MsgBox "Please Input the right User Name and the right Password"
End If
End If
End Sub
Private Sub CommandButton2_Click()
ThisWorkbook.Application.Quit
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
ThisWorkbook.Application.Quit
End Sub