i'm trying to empty "ThisWorkbook" module for all excel files in the same directory. Here is my code, but it pops up an Compile error: Expected end sub when i run it.
Please help!
Please help!
Code:
Sub RemoveWbkCode()
Dim itm As String
itm = Dir(ThisWorkbook.Path & "\*.xls")
Do While itm <> ""
If itm = ThisWorkbook.Name Then GoTo 66
Workbooks.Open ThisWorkbook.Path & "\" & itm
With ActiveWorkbook.VBProject.VBComponents("thisworkbook").CodeModule
.DeleteLines 1, .CountOfLines
End With
ActiveWorkbook.Close True
66 itm = Dir
Loop
End Sub