Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I hve found this code to delete all code within a workbook.
As soon the code reach the line If "ThisWorkbook.VBProject.Protection Then Exit Sub" the code stop and a failure message appear "if without end if " could you please help me with this issue. Thanks Sub ClearThisWorkbookCode() Dim StartLine As Long, LineCount As Long If ThisWorkbook.VBProject.Protection Then Exit Sub On Error Resume Next With ActiveWorkbook.VBProject.VBComponents("ThisWorkboo k").CodeModule StartLine = .ProcStartLine("Workbook_Open", 0) If StartLine Then LineCount = .ProcCountLines("Workbook_Open", 0) .DeleteLines StartLine, LineCount End If End With End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Delete code | Excel Programming | |||
Can code delete code | Excel Programming | |||
Code to delete a Line in a another code | Excel Programming | |||
VBA code delete code but ask for password and unlock VBA protection | Excel Programming | |||
VBA code to delete VBA code in another Workbook | Excel Programming |