Sub Commenter(NomMacro As String)
Dim Debut As Long, Fin As Long, Ligne As Long, Texte As String
Dim NomModule As String
With ThisWorkbook
With .VBProject.VBComponents("Module1").CodeModule 'Module 1
Debut = .ProcStartLine(NomMacro, vbext_pk_Proc)
Fin = .ProcCountLines(NomMacro, 0) + Debut - 1
For Ligne = Debut + 1 To Fin - 1
If .Lines(Ligne, 1) <> "" And Left(.Lines(Ligne, 1), 3) <> "Sub" Then
Texte = "'" & .Lines(Ligne, 1)
.ReplaceLine (Ligne), Texte
End If
Next
End With
End With
End Sub
Sub DéCommenter(NomMacro As String)
Dim Debut As Long, Fin As Long, Ligne As Long, Texte As String
Dim NomModule As String
With ThisWorkbook
With .VBProject.VBComponents("Module1").CodeModule 'Module 1
Debut = .ProcStartLine(NomMacro, vbext_pk_Proc)
Fin = .ProcCountLines(NomMacro, 0) + Debut - 1
For Ligne = Debut + 1 To Fin - 1
If .Lines(Ligne, 1) <> "" Then
Texte = .Lines(Ligne, 1)
Texte = Right(Texte, Len(Texte) - 1)
.ReplaceLine (Ligne), Texte
End If
Next
End With
End With
End Sub