Private Sub cmdOK_Click()
'verification ancien mot de passe
If Sheets("mot").Range("b2").Value <> txtAncienMot.Text Then
MsgBox "L'ancien mot de passe est incorrect", vbCritical, "Ancien Mot de passe"
txtAncienMot = ""
txtAncienMot.SetFocus
Exit Sub
End If
If Sheets("mot").Range("a2").Value <> txtNom.Text Then
MsgBox "Le nom est incorrect", vbCritical, "Nom d'utilisateur"
txtNom = ""
txtNom.SetFocus
Exit Sub
End If
If Sheets("mot").Range("c2").Value <> txtPrenom.Text Then
MsgBox "Le prénom est incorrect", vbCritical, "Prénom d'utilisateur"
txtPrenom = ""
txtPrenom.SetFocus
Exit Sub
End If
'enregistrement
With Sheets("mot")
.Range("a2").Value = txtNom
.Range("b2").Value = txtNouveauMot
.Range("c2").Value = txtPrenom
End With
MsgBox "Enregistrement avec succès", vbInformation, "Changement"
txtNom = ""
txtAncienMot = ""
txtNouveauMot = ""
txtPrenom = ""
txtNom.SetFocus
End Sub