Protéger avec mode passe sans affichage message "oter la protection"

Bonjour le forum

Alors j'ai fait un macro pour protéger et déprotéger automatiquement la feuille active comme cela

Private Sub Worksheet_Activate()

Call Déprotéger
If ActiveSheet.FilterMode = True Then ActiveSheet.ShowAllData
Call Protéger
End Sub

avec le macro Protéger / Déprotéger

Sub Déprotéger()
    ActiveSheet.Unprotect
End Sub
Sub Protéger()
'Exit Sub
On Error GoTo Protéger_Erreur

If ActiveSheet.Name = "Paramètres" Then
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
         , AllowFormattingCells:=True, AllowSorting:=True, AllowFiltering:=True, AllowUsingPivotTables:=True
Else
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
         , AllowFormattingCells:=False, AllowSorting:=True, AllowFiltering:=True, AllowUsingPivotTables:=True
End If

Protéger_exit:
Exit Sub

Protéger_Erreur:
MsgBox Error$
Resume Protéger_exit

End Sub

Mais le problème c'est que lorsque j'ajoute sur le macro Protéger le mode passe "PASSOWORD" il m'affiche toujours le message d’ôter la protection (voir l'mage ci- dessous),Alors est ce que c'est possible de n'affiche pas cette fenêtre d’ôter la protection de la feuille

capture prot2ger

Bonjour Issam, bonjour le forum,

Pas sûr d'avoir bien compris mais si ton mot de passe est par exemple : toto, tu déprotègeras sans message avec :

ActiveSheet.Unprotect "toto"

OUI super Merci bouceaup

alors moi en avant j"ai fait juste ActiveSheet.Protect Password:="modepass", et je laisse ActiveSheet.UNprotect vide

Rechercher des sujets similaires à "proteger mode passe affichage message oter protection"