Hi Ken
There is code on Chip's site to delete all code in the project also.
Look again on the site
--
Regards Ron de Bruin
http://www.rondebruin.nl
"Ken Loomis" wrote in message ...
After creating a report, I use the following to delete all the code in the main module before passing it along:
Sub DeleteAllCodeInModule()
Dim VBCodeMod As CodeModule
Dim StartLine As Long
Dim HowManyLines As Long
Set VBCodeMod = ThisWorkbook.VBProject.VBComponents("Module3").Cod eModule
With VBCodeMod
StartLine = 1
HowManyLines = .CountOfLines
.DeleteLines StartLine, HowManyLines
End With
End Sub
Now I realize I need to also delete all the code that executes when the workbook is first opened. How can I modify the code above
to delete the lines of code in ThisWorkbook?