Hello,
I must first preface this with I am not a programmer, but I try.
I’m looking for an Excel function to delete a procedure(s). I found a procedure on line that does this (I wish I could find it again and give the author credit). However, since it is written to delete only one specific procedure – I have more than one. Is it possible to convert the Sub into a Function?
Here is the existing Sub Procedure:
Sub DeleteProcedureFromModule()
Dim VBProj As VBIDE.VBProject
Dim VBComp As VBIDE.VBComponent
Dim CodeMod As VBIDE.CodeModule
Dim StartLine As Long
Dim NumLines As Long
Dim ProcName As String
Set VBProj = ActiveWorkbook.VBProject
Set VBComp = VBProj.VBComponents("Module1")
Set CodeMod = VBComp.CodeModule
ProcName = "DeleteThisProc”
With CodeMod
StartLine = .ProcStartLine(ProcName, vbext_pk_Proc)
NumLines = .ProcCountLines(ProcName, vbext_pk_Proc)
.DeleteLines StartLine:=StartLine, Count:=NumLines
End With
End Sub
Thanks for viewing,
Steve K.
Bookmarks