protection vba avec excel 2003

  • Initiateur de la discussion Initiateur de la discussion francoisd25
  • Date de début Date de début

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

F

francoisd25

Guest
j'avais écrit 2 s/prog en vba pour proteger (et déprotéger) toutes les feuilles d'un classeur excel. Ca fonctionnait bien sous excel 97 et 2000 mais ça ne fonctionne plus sous excel 2003!!! Quel'un a-t-il un remède à mon problème. Merci d'avance

Public Sub Protection()
réponse = InputBox("Entrer OUI ou NON", "Protection", "OUI")
If réponse = "OUI" Then
For Each w In Application.ActiveWorkbook.Sheets
If w.Protect = False Then
w.Protect
End If
Next
End If
End Sub

Public Sub Déprotection()
réponse = InputBox("Entrer OUI ou NON", "Déprotection", "OUI")
If réponse = "OUI" Then
For Each w In Application.ActiveWorkbook.Sheets
If w.Protect = True Then
w.Unprotect
End If
Next
End If
End Sub
 
bonsoir Francois

je n'ai qu'Excel2002 pour faire des essais , mais tu déja peux tester cette adaptation


Sub Protection()
Dim Reponse As String
Dim w As Worksheet
Reponse = InputBox("Entrer OUI ou NON", "Protection", "OUI")
If Reponse = "OUI" Then
For Each w In ActiveWorkbook.Sheets
w.Protect
Next
End If
End Sub

Sub Déprotection()
Dim w As Worksheet
Dim Reponse As String
Reponse = InputBox("Entrer OUI ou NON", "Déprotection", "OUI")
If Reponse = "OUI" Then
For Each w In ActiveWorkbook.Sheets
w.Unprotect
Next
End If
End Sub


bonne soiree
MichelXld
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD
Assurez vous de marquer un message comme solution pour une meilleure transparence.

Discussions similaires

  • Question Question
XL 2021 VBA excel
Réponses
4
Affichages
115
Réponses
4
Affichages
387
  • Question Question
Microsoft 365 Probléme VBA
Réponses
8
Affichages
253
Retour