Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Bob,
I tied the code, but I must be doing soemthing wrong because I get the following error: Method 'VBProject' of object '_Workbook' failed. Can you help me with this? Many Thanks! Ray Collins -- Ray "Bob Phillips" wrote: Here is an example to delete a procedure 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 -- HTH RP (remove nothere from the email address if mailing direct) "ScottG" wrote in message ... We automate Excel (v10) to generate a bunch a workbooks which populate and format themselves with an imbedded macro. Is there any way to programmatically delete the macro before distributing the documents? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Problem with excel macro - getting automation error | Charts and Charting in Excel | |||
Disable macro in excel automation with VC++/Win2k | Excel Programming | |||
How to create a VB macro in Excel from Automation... | Excel Programming | |||
Macro 'Automation error' with ChemOffice Excel macro | Excel Programming | |||
access 97 to excel 97: execute macro automation | Excel Programming |