J
jpoldeux
Guest
Bonjour,
Une procédure est lancée depuis un fichier A pour activer ou désactiver la protection des feuilles d'un fichier B.
La méthode Unprotect ouvre les feuilles une à une, ce qui fait sauter l'écran de façon désagréable.
La méthode Protect ne présente pas cet inconvénient.
Sub Proteger()
Dim ws As Worksheet
With Workbooks("FichierB.xlsx")
For Each ws In .Worksheets
ws.Protect Password:="toto"
Next ws
End With
End Sub
Sub Deproteger()
Dim ws As Worksheet
With Workbooks("FichierB.xlsx")
For Each ws In .Worksheets
ws.Unprotect Password:="toto"
Next ws
End With
End Sub
J'ai essayé ScreenUpdating mais ça ne fonctionne pas. Un palliatif consiste à commencer par activer le fichier B, l'impression visuelle étant alors un peu meilleure.
Comment faire pour que Unprotect se comporte comme Protect ?
Jean
Une procédure est lancée depuis un fichier A pour activer ou désactiver la protection des feuilles d'un fichier B.
La méthode Unprotect ouvre les feuilles une à une, ce qui fait sauter l'écran de façon désagréable.
La méthode Protect ne présente pas cet inconvénient.
Sub Proteger()
Dim ws As Worksheet
With Workbooks("FichierB.xlsx")
For Each ws In .Worksheets
ws.Protect Password:="toto"
Next ws
End With
End Sub
Sub Deproteger()
Dim ws As Worksheet
With Workbooks("FichierB.xlsx")
For Each ws In .Worksheets
ws.Unprotect Password:="toto"
Next ws
End With
End Sub
J'ai essayé ScreenUpdating mais ça ne fonctionne pas. Un palliatif consiste à commencer par activer le fichier B, l'impression visuelle étant alors un peu meilleure.
Comment faire pour que Unprotect se comporte comme Protect ?
Jean