From Chip Pearson's web site...
http://www.cpearson.com/excel/vbe.aspx
Deleting All VBA Code In A Project
This code will delete ALL VBA code in a VBProject.
Sub DeleteAllVBACode()
Dim VBProj As VBIDE.VBProject
Dim VBComp As VBIDE.VBComponent
Dim CodeMod As VBIDE.CodeModule
Set VBProj = ActiveWorkbook.VBProject
For Each VBComp In VBProj.VBComponents
If VBComp.Type = vbext_ct_Document Then
Set CodeMod = VBComp.CodeModule
With CodeMod
.DeleteLines 1, .CountOfLines
End With
Else
VBProj.VBComponents.Remove VBComp
End If
Next VBComp
End Sub
--
HTH...
Jim Thomlinson
" wrote:
Hi I have the following proceedure sat in a worksheet (sheet1):
Private Sub CommandButton1_Click()
RefreshSheets
End Sub
I have been able to successfully get rid of the sub called
'RefreshSheets' from my module, so the code does absolutely nothing
(and CommandButton1 has also been deleted programatically), but how to
I get rid of this redundant code that remains.
I need to remove it as the workbook still thinks it contains a macro
(even tho there is no actual code within the resulting sub!) and so
when I email the workbook, the recipients email client rejects it as
harmful.
Any help greatly appreciated.
Cheers!