View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
papou[_7_] papou[_7_] is offline
external usenet poster
 
Posts: 41
Default Why "User-defined type not defined"

Hello Shatin
Add a reference to Microsoft Visual Basic 6.0 Extensibility
HTH
Regards
Pascal

"Shatin" a écrit dans le message de
om...
I got the following lines in my macro:

Dim VBCodeMod As CodeModule
Dim LineNum As Long

ActiveWorkbook.VBProject.VBComponents.Add vbext_ct_StdModule
Set VBCodeMod = Application.VBE.CodePanes(1).CodeModule

I think I copied those lines from the Pearson site. When I run the
macro from my personal.xls file, the macro runs without any problem.
However, when I copy the macro to a new file in the document folder,
the line "VBCodeMod As CodeModule" is highlighted and this error msg
appears:

Compile error:
User-defined typ not defined

Can someone please tell me what this error is? And why this error
since the macro runs problem free from the personal.xls?

TIA.