1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Sub Supprimer_UserForm()
Set CL1 = ThisWorkbook 'Le fichier contenant ces macros
Set CL2 = ActiveWorkbook
Set VBComp = CL2.VBProject.VBComponents
With VBComp
For Each VBComp In CL2.VBProject.VBComponents
Debug.Print VBComp.Name
If VBComp.Name = "UserForm1" Then _
SupprimerLeModule CL2, VBComp.Name
Next VBComp
End With
AjoutterLeModule CL2, "C:\Users\rdurupt\Desktop\UserForm1.frm"
End Sub
Sub SupprimerLeModule(CL2, NomModule)
With CL2.VBProject
.VBComponents.Remove .VBComponents(NomModule)
End With
End Sub
Sub AjoutterLeModule(CL2, NomModule)
With CL2.VBProject
.VBComponents.Import NomModule
End With
End Sub |
Partager