The following example should work for a sheet named Sheet1
Dim VBComp As Object
Set VBComp = Application.VBE.ActiveVBProject.VBComponents("Sheet1"
With VBComp.CodeModule
.DeleteLines 1, .countoflines
End With
I haven't done this specifically, but I believe it to work. You can COPY the specific sheet to a new workbook. I have done all the code regarding the COPY sheet / save workbook but not togther (although I have thought about it too )
Anyways when you 'copy sheet' it doesn't copy any embedded event codes and a new workbook obviously wouldn't have any modules either.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.