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

Reference for me is greyed out so that is a porblem. Is there something else
that needs to be enabled in order for that option to be active? Also, if I
make that reference in the library does that reference stay with the workbook
so it will work for anyone who uses it? I don't want everyone who needs to
use this have to make this reference. Tom mentioned declaring a generic
object. How would this be done?

"Jim Thomlinson" wrote:

You need to reference your project to the Extensibility library.

Tools - Reference - Microsoft Visual Basic for Applications Extensibility
?.?


--
HTH...

Jim Thomlinson


"hshayh0rn" wrote:

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?