Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can a macro delete itself (and others)?
From an Excel VBA app (running as an excel macro) is it possible to delete
the macro and all other macros, while the present macro is running? If so, how? -- -mdb |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can a macro delete itself (and others)?
Hi MDB,
See ChipPearson at: http://www.cpearson.com/excel/vbe.htm And, previously posted by Chip: Sub SelfDestruct() Dim VBCodeMod As CodeModule Dim StartLine As Long Dim HowManyLines As Long Set VBCodeMod = ThisWorkbook.VBProject. _ VBComponents("NewModule").CodeModule With VBCodeMod StartLine = .ProcStartLine("SelfDestruct", vbext_pk_Proc) HowManyLines = .ProcCountLines("SelfDestruct", vbext_pk_Proc) .DeleteLines StartLine, HowManyLines End With End Sub --- Regards, Norman "mdb" <m_b_r_a_y@c_t_i_u_s_a__d0t__com wrote in message . .. From an Excel VBA app (running as an excel macro) is it possible to delete the macro and all other macros, while the present macro is running? If so, how? -- -mdb |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can a macro delete itself (and others)?
See
http://www.cpearson.com/excel/vbe.htm Here is example With One macro named "TheMacro" in Module1 The simplest way is to delete the entire module with contains the procedure. Sub TheMacro() ' ' your code ' With ThisWorkbook.VBProject.VBCompo*nents .Remove .Item("Module1") End With End Sub But this must be checked to do this http://www.j-walk.com/ss/excel/tips/tip96.htm -- Regards Ron de Bruin http://www.rondebruin.nl "mdb" <m_b_r_a_y@c_t_i_u_s_a__d0t__com wrote in message . .. From an Excel VBA app (running as an excel macro) is it possible to delete the macro and all other macros, while the present macro is running? If so, how? -- -mdb |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can a macro delete itself (and others)?
That stupid Google Beta<g
Note the - in the code in y other reply Sub TheMacro() ' ' your code ' With ThisWorkbook.VBProject.VBComponents .Remove .Item("Module1") End With End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Ron de Bruin" wrote in message ... See http://www.cpearson.com/excel/vbe.htm Here is example With One macro named "TheMacro" in Module1 The simplest way is to delete the entire module with contains the procedure. Sub TheMacro() ' ' your code ' With ThisWorkbook.VBProject.VBCompo*nents .Remove .Item("Module1") End With End Sub But this must be checked to do this http://www.j-walk.com/ss/excel/tips/tip96.htm -- Regards Ron de Bruin http://www.rondebruin.nl "mdb" <m_b_r_a_y@c_t_i_u_s_a__d0t__com wrote in message . .. From an Excel VBA app (running as an excel macro) is it possible to delete the macro and all other macros, while the present macro is running? If so, how? -- -mdb |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming |