user defined type not defined ??

M

mark kubicki

with downloaded code (from chip pearson's site) to remove all of the code
behind a worksheet, I've added this code which on the first line, returns
this error "user defined type not defined"

(the code is located in an command button click event, and behind a
(different) sheet which is where the command button exists.)

error is on this line --> Dim VBCodeMod As CodeModule
Dim StartLine As Long
Dim HowManyLines As Long

Set VBCodeMod = ThisWorkbook.VBProject.VBComponents("NewModule").CodeModule
With VBCodeMod
StartLine = 1
HowManyLines = .CountOfLines
.DeleteLines StartLine, HowManyLines
End With
 
T

Tom Ogilvy

As it says at the top of the page, you need to create a reference to the
Extensibility Library.
 
B

Bob Phillips

or just declare it as Object not CodeModule.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top