View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default deleting code by macro

Later versions of Excel have Macro Security which prevent this sort of
activity without having been trusted.

Sub test()
Dim vbc As VBComponent

For Each vbc In ActiveWorkbook.VBProject.VBComponents
vbc.CodeModule.DeleteLines 1, vbc.CodeModule.CountOfLines
Next
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"jriehl" wrote in message
...
Hi there,

is it possible to delete all of a workbooks code automatically by means of

a
macro?

Lots of thanks

Jürgen