D
Danny
If there a way to delete all the macros if the workbook is saved with another
name?
Thanks,
Danny
name?
Thanks,
Danny
or if there is no code in the sheet modules you can do this
Ron de Bruin said:Hi Danny
Sheets.copy
This code line create a new workbook with all sheets.
But if there is also code in the sheet modules you can use the example below :
You can delete the code in your sheet modules with Chip's code
http://www.cpearson.com/excel/vbe.htm
This is working OK for the activeworkbook
No reference needed in the example
Read the note on Chip's site about "Trust access to Visual Basic Project"
Public Sub DeleteAllVBA()
Dim VBComp As Object
Dim VBComps As Object
Set VBComps = ActiveWorkbook.VBProject.VBComponents
For Each VBComp In VBComps
Select Case VBComp.Type
Case 1, 3, _
2
VBComps.Remove VBComp
Case Else
With VBComp.CodeModule
.DeleteLines 1, .CountOfLines
End With
End Select
Next VBComp
End Sub