application.VBE.VBProjects(x).VBComponents(x).CodeModule.DeleteLines 1, x
必须先引用:Microsoft Visual Basic for Applications Extensibility 5.3(我的是office 03)
Application.VBE.ActiveVBProject.VBComponents.Remove Application.VBE.ActiveVBProject.VBComponents("模块1")
而且要在宏安全性里勾选"信任对于"Visual Basic项目"的访问(V)".