![]() |
Macro to delete Macro
I want to create a macro X that will delete another macro Y - assume macro X
is stored in the Personal Macro Workbook & macro Y is stored in the currently active workbook. What is the code to delete a macro? |
Macro to delete Macro
Have a look at Chip Pearson's website:
http://www.cpearson.com/excel/vbe.htm RBS "Lynn" wrote in message ... I want to create a macro X that will delete another macro Y - assume macro X is stored in the Personal Macro Workbook & macro Y is stored in the currently active workbook. What is the code to delete a macro? |
Macro to delete Macro
Here is some code that deletes myProc from Module1
Sub DeleteProcedure() Const vbext_pk_Proc = 0 Dim oCodeModule As Object Dim iStart As Long Dim cLines As Long Set oCodeModule = ThisWorkbook.VBProject.VBComponents("Module1").Cod eModule With oCodeModule iStart = .ProcStartLine("myProc", 0) cLines = .ProcCountLines("myProc", 0) .DeleteLines iStart, cLines End With End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Lynn" wrote in message ... I want to create a macro X that will delete another macro Y - assume macro X is stored in the Personal Macro Workbook & macro Y is stored in the currently active workbook. What is the code to delete a macro? |
All times are GMT +1. The time now is 08:41 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com