Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The following function was posted on this site to delete macros:
Const vbext_pk_Proc = 0 '---------------------------------------------------------------- Sub DeleteProcedure() '---------------------------------------------------------------- Dim oCodeModule As Object Dim iStart As Long Dim cLines As Long Set oCodeModule = ThisWorkbook.VBProject.VBComponents("Module1").Cod eModule With oCodeModule On Error GoTo dp_err: iStart = .ProcStartLine("myProc", vbext_pk_Proc) cLines = .ProcCountLines("myProc", vbext_pk_Proc) .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 When I try it out, I get the following error: Method 'VBProject' of object '_Workbook' failed. Anyone have a clue about what I'm doing wrong? Many Thanks! -- Ray |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Deleting Macros | Excel Discussion (Misc queries) | |||
Deleting Macros | Excel Discussion (Misc queries) | |||
How to use automation Add-In to replace Excel macros!! | Excel Programming | |||
Automation Error when deleting command bar button | Excel Programming | |||
Outlook Automation, Deleting Tasks | Excel Programming |