Bonjour,
j'ai fais une macro de protection, mais j'aurai voulu y mettre 2 mot de passe.
j'ai fais cela, mais ca ne fonctionne pas, si qq'un aurait une idée
voila le code que j'ai :
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
mdp = InputBox(vbCrLf & " Veuillez entrer le mot de passe." & vbCrLf & vbCrLf & " Attention si le mot de passe est incorrect, le fichier sera fermé ! ", " Déprotection ")
If mdp = "" Then Exit Sub
If mdp <> "toto" or "toto1" Then
MsgBox " Erreur de Mot de passe." & vbTab & vbCrLf & "Un mail va etre envoyé à l'Administrateur du fichier.", vbCritical, " Mot de passe incorrect"
Call UseOutlook
Call Macro4
Else
For Each Sh In Sheets
Sh.Unprotect mdp
Next Sh
Me.CommandButton1.Visible = False
Me.CommandButton2.Visible = True
Sheets("test").Visible = True
Sheets("Combi compagnon 2 FERMETURE").Visible = True
End If
MsgBox " Attention à vos modifications ", , " Fichier Non Protegé "
End Sub
Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
For Each Sh In Sheets
Sh.Protect "toto" or "toto1" Then
Next Sh
Me.CommandButton1.Visible = True
Me.CommandButton2.Visible = False
Sheets("test").Visible = False
Sheets("Combi compagnon 2 FERMETURE").Visible = False
End Sub
merci d'avance pour vos idées