Have a look here for full details:-
http://www.cpearson.com/excel/vbe.htm
Regards,
Dax.
Thanks for the link. Just what I was looking for.
I tried the link but Excel 97 doesn't seem to recognise some of the code. The code given is as follows: Does anyone know how to adjust this to Excel 97?
Sub DeleteAllVBA()
Dim VBComp As VBIDE.VBComponent
Dim VBComps As VBIDE.VBComponents
Set VBComps = ActiveWorkbook.VBProject.VBComponents
For Each VBComp In VBComps
Select Case VBComp.Type
Case vbext_ct_stdmodule, vbext_ct_MSForm, vbext_ct_classmodule
VBComps.Remove VBComp
Case Else
With VBComp.CodeModule
.DeleteLines 1, .CountOfLines
End With
End Select
Next VBComp
End Sub
Thanks for the link. Just what I was looking for.
Sub DeleteAllVBA() Dim VBComp As VBIDE.VBComponent
The code will work fine with Excel 97 - I just tried it. You need to ensure that you've set a reference to correct library. In the VB editor click Tools, Reference and select Microsoft Visual Basic for Applications Extensibility.
Regards,
Dax.
You're a Star! thanks Dax