Private Sub Cmd_Ok_Btn_Click()
Dim Rech As Range
Dim sFeuille As String
Static TentativePW As Byte, TentativeID As Byte
If Txb_ID_Util = Empty Then Exit Sub
Set Rech = Sheets("Admin").Range("A:A").Find(Txb_ID_Util, LookIn:=xlValues, lookat:=xlWhole)
If Not Rech Is Nothing Then
If Txb_Pwd_Util = Rech.Offset(0, 1) Then
Me.Hide ' Masquer l'USF
sFeuille = Rech.Offset(0, 2)
AfficherFeuille (sFeuille)
' Fermer l'USF
Unload Me
Else
TentativePW = TentativePW + 1
If TentativePW > 3 Then ThisWorkbook.Close 0
MsgBox "Mot de passe invalide, Tentative N° " & TentativePW & " Sur 3", vbCritical, T
With Me.Txb_Pwd_Util
.Value = ""
.SetFocus
End With
End If
Else
TentativeID = TentativeID + 1
If TentativeID > 3 Then ThisWorkbook.Close 0
MsgBox "Utilisateur inconnu, , Tentative N° " & TentativeID & " Sur 3", vbCritical, T
With Me.Txb_ID_Util
.SetFocus
.SelStart = 0
.SelLength = Len(Me.Txb_ID_Util.Text)
End With
End If
End Sub