A few weeks ago I found some code from this discussion group that allowed me
to delete all of the code modules from a workbook:
Set VBComps = NewBook.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
It worked like a charm. Yesterday I got a new computer at work running XP
and Excel 2003. Now I'm getting this error message:
runtime error '1004' Programmatic access to Visual Basic Project is not
trusted.
I have my security settings on low. Any ideas of how I can make this work
again?
Bookmarks