View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Vacuum Sealed[_2_] Vacuum Sealed[_2_] is offline
external usenet poster
 
Posts: 87
Default How to Remove Code

Thank you Don & Pete

I checked out Chips Stie which had what looked like code that would do the
job, but It may be limited to 2007 onwards.

The work computer only has 2003 and it halts on ** This ?Section **:

** Set VBProj = ActiveWorkbook.VBProject **

Set VBComp = VBProj.VBComponents("ThisWorkbook")
Set CodeMod = VBComp.CodeModule

ProcName = "Private Sub Workbook_Open()"

With CodeMod
StartLine = .ProcStartLine(ProcName, vbext_pk_Proc)
NumLines = .ProcCountLines(ProcName, vbext_pk_Proc)
.DeleteLines StartLine:=StartLine, Count:=NumLines
End With

Chip if you happen to be reading this, I could certainly use your guidance
please.

I then thought to myself that, as I was executing this within the workbook I
was attempting to rid the hidden code of, it may have some influence on
whether or not it would allow itself to trigger, so I tried executing it
from another workbook and it popped up with:

Error # 1004 - You do not have permission to do that.

Now, I'm assuming I do not have permission to delete/remove the code behind
"ThisWorkbook", not sure, it's disappointing as this was the final hurdle to
complete this project.

Open to any suggestions

Cheers
Mick