Deleting macro

  • Thread starter Thread starter Stephane
  • Start date Start date
S

Stephane

Hi,

is it possible to delete a macro in VBA code??? If yes, what's the code???

Thanks
Stephane
 
You can do it with code like the following:

With ThisWorkbook.VBProject.VBComponents("Module1").CodeModule
.DeleteLines .ProcStartLine("MacroName", 0), _
.ProcCountLines("MacroName", 0)
End With

If you are using Excel 2002 or 2003, you will need to manually tell Excel to
trust macro modifications of vba code. I believe it is found via Tools,
Macros. Set back when done.

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
 

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