SLG,
Requires a reference to the MS VBA extensibility, and acts on the
activeworkbook, but that is easy enough to change:
Sub RemoveAllVBACode()
Dim myVBA As VBIDE.VBComponent
For Each myVBA In ActiveWorkbook.VBProject.VBComponents
If myVBA.Type = vbext_ct_Document Then
With myVBA.CodeModule
.DeleteLines 1, .CountOfLines
End With
Else
ActiveWorkbook.VBProject.VBComponents.Remove myVBA
End If
Next myVBA
End Sub
HTH,
Bernie
MS Excel MVP