Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Why "User-defined type not defined"

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default Why "User-defined type not defined"

Hi Shatin,

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?


You need a reference to the VBE Extensibilty library (Tools, References
from within the VBE)

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
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.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Why "User-defined type not defined"

Shatin,

The reference to set is called
Microsoft Visual Basic for Applications Extensibility n.n
where n.n is a version number.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Shatin" wrote in message
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.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Why "User-defined type not defined"

Problem solved! Thanks to you all for your help!


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Message "user defined type not defined" LEELK01 Excel Discussion (Misc queries) 2 August 14th 09 07:31 AM
How do you save and share "user-defined chart type's" in Excel? Jocelynne Charts and Charting in Excel 1 August 24th 06 08:46 AM
How do you save and share "user-defined chart type's" in Excel? Jocelynne Charts and Charting in Excel 0 August 23rd 06 08:51 PM
"User-defined type not defined" message in Excel RW1946 Excel Discussion (Misc queries) 0 August 31st 05 12:14 PM
Word.Document - user defined type not defined jowatkins[_7_] Excel Programming 0 January 20th 04 08:46 AM


All times are GMT +1. The time now is 01:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"