I only have Office 2k so I can't test this myself... What I want to know is in 2002 and up, if the 'Trust Access to Visual Basic Project' is left unchecked, will using late binding allow this code (specifically) to run?
Note: Caution!! This deletes ALL VBA code in the workbook[vba]
Sub DeleteAllVBA()
'use late binding so no reference is needed
Dim Component As Object
For Each Component In ThisWorkbook.VBProject.VBComponents
Select Case Component.Type
Case 1, 2, 3
ThisWorkbook.VBProject.VBComponents.Remove Component
Case Else
With Component.CodeModule
.DeleteLines 1, .CountOfLines
End With
End Select
Next
End Sub
[/vba]TIA,
John