View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
hshayh0rn hshayh0rn is offline
external usenet poster
 
Posts: 74
Default Deleting VBA code

I'm working with EXCEL 2003 and I'm trying to use the following code:

Dim VBCodeMod As CodeModule
Dim StartLine As Long
Dim HowManyLines As Long

Set VBCodeMod = ThisWorkbook.VBProject.VBComponents("Startup").Cod eModule
With VBCodeMod
StartLine = 1
HowManyLines = .CountOfLines
.DeleteLines StartLine, HowManyLines
End With


When it runs I get the following error:

Compile Error - User -defined type not defined

I have checked to be sure that under tools-macros-security and trusted
publishers that both the check boxes are checked which I've seen in other
posts could be an issue. So, does anyone know what the issue might be related
to the error?