Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have this macro (below) that I would like to remove using another macro.
It is located in 'ThisWorkbook'. Private Sub Workbook_Open() What code can I use in a Macro to remove 'Private Sub Workbook_Open()'? Thanks, Paul |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
'----------------------------------------------------------------
Sub DeleteProcedure() '---------------------------------------------------------------- Dim oCodeModule As Object Dim iStart As Long Dim cLines As Long Set oCodeModule = ThisWorkbook.VBProject.VBComponents("ThisWorkbook" ).CodeModule With oCodeModule On Error GoTo dp_err: iStart = .ProcStartLine("Workbook_Open", 0) cLines = .ProcCountLines("Workbook_Open", 0) .DeleteLines iStart, cLines On Error GoTo 0 Exit Sub End With dp_err: If Err.Number = 35 Then MsgBox "Procedure does not exist" End If End Sub -- HTH Bob Phillips "PCLIVE" wrote in message ... I have this macro (below) that I would like to remove using another macro. It is located in 'ThisWorkbook'. Private Sub Workbook_Open() What code can I use in a Macro to remove 'Private Sub Workbook_Open()'? Thanks, Paul |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Bob. You're right-on!
I really appreciate it. Regards, Paul "Bob Phillips" wrote in message ... '---------------------------------------------------------------- Sub DeleteProcedure() '---------------------------------------------------------------- Dim oCodeModule As Object Dim iStart As Long Dim cLines As Long Set oCodeModule = ThisWorkbook.VBProject.VBComponents("ThisWorkbook" ).CodeModule With oCodeModule On Error GoTo dp_err: iStart = .ProcStartLine("Workbook_Open", 0) cLines = .ProcCountLines("Workbook_Open", 0) .DeleteLines iStart, cLines On Error GoTo 0 Exit Sub End With dp_err: If Err.Number = 35 Then MsgBox "Procedure does not exist" End If End Sub -- HTH Bob Phillips "PCLIVE" wrote in message ... I have this macro (below) that I would like to remove using another macro. It is located in 'ThisWorkbook'. Private Sub Workbook_Open() What code can I use in a Macro to remove 'Private Sub Workbook_Open()'? Thanks, Paul |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
See Chip Pearson's site for info on this subject.
http://www.cpearson.com/excel/vbe.htm Gord Dibben Excel MVP On Fri, 1 Jul 2005 14:24:42 -0400, "PCLIVE" wrote: I have this macro (below) that I would like to remove using another macro. It is located in 'ThisWorkbook'. Private Sub Workbook_Open() What code can I use in a Macro to remove 'Private Sub Workbook_Open()'? Thanks, Paul |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
remove a Macro | Excel Discussion (Misc queries) | |||
Macro - Remove #n/a | Excel Discussion (Misc queries) | |||
macro 4.remove | Excel Discussion (Misc queries) | |||
Macro to Remove Macro Text | Excel Discussion (Misc queries) | |||
remove macro | New Users to Excel |