Private Sub CommandButton1_Click()
form2.TextBox1.Value = TextBox1.Value
Dim UserName As String, Password As String
Dim rngUser As Range
Dim firstUser As String
Dim UserFound As Boolean
If TextBox1.Value = "" Then
MsgBox ("ÃÏÎá ÇÓã ÇáãÓÊÎÏã"), vbOKOnly
TextBox1.SetFocus
Exit Sub
End If
If TextBox2.Value = "" Then
MsgBox ("ÃÏÎá ßáãÉ ÇáãÑæÑ"), vbOKOnly
TextBox2.SetFocus
Exit Sub
End If
UserName = TextBox1.Value
Password = TextBox2.Value
With Range("D:D")
Set rngUser = .Find(UserName, lookat:=xlWhole)
If Not rngUser Is Nothing Then
firstUser = rngUser.Address
Do
If Password = rngUser.Offset(0, 1).Value & "" Then
UserFound = True
Unload Me
MsgBox ("ÃåáÇ æÓåáÇ Èß Ýí ÈÑäÇãÌ ãÓØÇÍ"), vbOKOnly
form1.Hide
form2.Show
Else
Set rngUser = .FindNext(rngUser)
End If
Loop While Not rngUser Is Nothing And firstUser <> rngUser.Address
Else
MsgBox "ÇÓã ÇáãÓÊÎÏã ÛíÑ ÕÍíÍ !", vbExclamation, "UserName Not Found!"
TextBox1.Value = ""
TextBox2.Value = ""
Exit Sub
End If
End With
If Not UserFound Then
MsgBox "ßáãÉ ÇáãÑæÑ ÛíÑ ÕÍíÍÉ!", vbOKOnly
TextBox1.Value = ""
TextBox2.Value = ""
TextBox1.SetFocus
End If
End Sub
Private Sub CommandButton2_Click()
'ThisWorkbook.Save
Application.Quit
End Sub
Private Sub CommandButton3_Click()
form2.TextBox1.Value = TextBox1.Value
End Sub
Private Sub Label2_Click()
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Cancel = True
End Sub
Private Sub CommandButton1_Click() form2.TextBox1.Value = TextBox1.Value Dim UserName As String, Password As String Dim rngUser As Range Dim firstUser As String Dim UserFound As Boolean If TextBox1.Value = "" Then MsgBox ("ÃÏÎá ÇÓã ÇáãÓÊÎÏã"), vbOKOnly TextBox1.SetFocus Exit Sub End If If TextBox2.Value = "" Then MsgBox ("ÃÏÎá ßáãÉ ÇáãÑæÑ"), vbOKOnly TextBox2.SetFocus Exit Sub End If UserName = TextBox1.Value Password = TextBox2.Value With Range("D

") Set rngUser = .Find(UserName, lookat:=xlWhole) If Not rngUser Is Nothing Then firstUser = rngUser.Address Do If Password = rngUser.Offset(0, 1).Value & "" Then UserFound = True Unload Me MsgBox ("ÃåáÇ æÓåáÇ Èß Ýí ÈÑäÇãÌ ãÓØÇÍ"), vbOKOnly form1.Hide form2.Show Else Set rngUser = .FindNext(rngUser) End If Loop While Not rngUser Is Nothing And firstUser <> rngUser.Address Else MsgBox "ÇÓã ÇáãÓÊÎÏã ÛíÑ ÕÍíÍ !", vbExclamation, "UserName Not Found!" TextBox1.Value = "" TextBox2.Value = "" Exit Sub End If End With If Not UserFound Then MsgBox "ßáãÉ ÇáãÑæÑ ÛíÑ ÕÍíÍÉ!", vbOKOnly TextBox1.Value = "" TextBox2.Value = "" TextBox1.SetFocus End If End Sub Private Sub CommandButton2_Click() 'ThisWorkbook.Save Application.Quit End Sub Private Sub CommandButton3_Click() form2.TextBox1.Value = TextBox1.Value End Sub Private Sub Label2_Click() End Sub Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) Cancel = True End Sub