Sub ProtectVBProject(WB As Workbook, ByVal Password As String)
Dim vbProj As Object
Set vbProj = WB.VBProject
If vbProj.Protection = 1 Then Exit Sub
Set Application.VBE.ActiveVBProject = vbProj
Application.VBE.CommandBars(1).FindControl(ID:=78, Recursive:=True).Execute 'La macro plante sur cette ligne
SendKeys "+{TAB}{RIGHT}%V{+}{TAB}" & Password & "{TAB}" & Password & "~", True
End Sub
Sub UnprotectVBProject(WB As Workbook, ByVal Password As String)
Dim vbProj As Object
Set vbProj = WB.VBProject
If vbProj.Protection <> 1 Then Exit Sub
Set Application.VBE.ActiveVBProject = vbProj
Application.VBE.CommandBars(1).FindControl(ID:=78, Recursive:=True).Execute 'La macro plante sur cette ligne
SendKeys Password & "~"
SendKeys "~"
End Sub