deleting code by macro

  • Thread starter Thread starter jriehl
  • Start date Start date
J

jriehl

Hi there,

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

Lots of thanks

Jürgen
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top