Before using these procedures, you'll need to
go into the VBA editor, go to the Tools menu,
choose the References item, and put a check
next to "Microsoft Visual Basic For
Applications Extensibility" library.
Sub delModule()
Dim VBComp As VBComponent
Set VBComp = ThisWorkbook.VBProject.VBComponents("Module1"

ThisWorkbook.VBProject.VBComponents.Remove VBComp
End Sub
Sub delForm()
Dim VBComp As VBComponent
Set VBComp = ThisWorkbook.VBProject.VBComponents("UserForm1"

ThisWorkbook.VBProject.VBComponents.Remove VBComp
End Sub