Executer Macro sur classeur protegé

Bonjour,

J'aimerais pouvoir exécuter une macro sur mon classeur protégé par mot de passe

1 réponse

  1. Bonjour

    dans ton code, tu dois déverrouiller ton classeur executer ta macro et reverrouiller ton classeur à la fin

    Sub Exemple()
    
    ActiveWorkbook.Unprotect Password:="mdp"
    ActiveSheet.Unprotect Password:="mdp"
    '
    'macro
    '
    ActiveWorkbook.Protect Password:="mdp", Structure:=True
    ActiveSheet.Protect Password:="mdp", DrawingObjects:=True, Contents:=True, Scenarios:=True, AllowSorting:=True, AllowFiltering:=True
    
    End Sub


    0