Hi Swansong,
Try the code posted by Chip Pearson:
'=============>>
Sub SelfDestruct()
Dim VBCodeMod As CodeModule
Dim StartLine As Long
Dim HowManyLines As Long
'Your code
Set VBCodeMod =
ThisWorkbook.VBProject.VBComponents("NewModule").CodeModule
With VBCodeMod
StartLine = .ProcStartLine("SelfDestruct", vbext_pk_Proc)
HowManyLines = .ProcCountLines("SelfDestruct", vbext_pk_Proc)
.DeleteLines StartLine, HowManyLines
End With
End Sub
'<<=============
See also Chip Pearson's Pogramming to the VBE page at:
Programming To The Visual Basic Editor
http://www.cpearson.com/excel/vbe.htm
Note Chip' instructions to set a reference to the VBA
Extensibility library.
---
Regards,
Norman