View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Delete a macro using a macro

Hi StephenT

Try this if "Trust access to VBA project object model" is checked if the macro is in Module1


Sub RunMacroAndDeletModule()
MsgBox "By module1"
With ThisWorkbook.VBProject.VBComponents
.Remove .Item("Module1")
End With
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm




"StephenT" wrote in message ...
Hello, I have written a macro to clean my workbook before publishing, and I
would like to delete a macro using this macro.

Can someone please help with the code to delete a macro?

This won't break the internet will it?