ALE37
XLDnaute Junior
Bonjour le forum, j'ai un bug sur l'utilisation de cette macro qui consiste à protéger et déprotéger à l'aide d'un bouton un classeur.
La protection fonctionne mais pas la déprotection. D'avance merci de votre aide.
Sub protect_classeur()
Application.ScreenUpdating = False
MDP = InputBox("Entrer mot de passe :", "Activation de la protection des feuilles")
If MDP <> "toto" Then
MsgBox "Mot de passe incorrect", vbCritical + vbOKOnly, "Erreur"
Exit Sub
End If
ThisWorkbook.Unprotect "toto"
With Worksheets("BD")
.Visible = xlSheetVisible
.Activate
.Unprotect "toto"
End With
ThisWorkbook.Protect "toto"
End Sub
La protection fonctionne mais pas la déprotection. D'avance merci de votre aide.
Sub protect_classeur()
Application.ScreenUpdating = False
MDP = InputBox("Entrer mot de passe :", "Activation de la protection des feuilles")
If MDP <> "toto" Then
MsgBox "Mot de passe incorrect", vbCritical + vbOKOnly, "Erreur"
Exit Sub
End If
ThisWorkbook.Unprotect "toto"
With Worksheets("BD")
.Visible = xlSheetVisible
.Activate
.Unprotect "toto"
End With
ThisWorkbook.Protect "toto"
End Sub