Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default User defined Type

I am trying to debug existing code and the following declaration won't work.

Private x2App As Excel.Application

I keep getting an error msg stating "user defined type not defined"

Here is the Type statement I have in the declaration section of my class
module.

Private Type UserDefinedType
Application As Object
Workbook As Object
Worksheet As Object
End Type

Private Type UserDefinedType2
Connection As Object
Command As Object
Parameter As Object
Recordset As Object
End Type

Option Explicit
Dim Excel(1 To 3) As UserDefinedType
Dim ADODB(1 To 19) As UserDefinedType2

Any solutions?
--
TWN
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default User defined Type

try changing
Dim Excel(1 To 3) As UserDefinedType
to
Dim udtExcel(1 To 3) As UserDefinedType

Same deal with ADODB. Both Excel and ADODB are reserved so you don't really
want to use them as variable names...
--
HTH...

Jim Thomlinson


"Trebor" wrote:

I am trying to debug existing code and the following declaration won't work.

Private x2App As Excel.Application

I keep getting an error msg stating "user defined type not defined"

Here is the Type statement I have in the declaration section of my class
module.

Private Type UserDefinedType
Application As Object
Workbook As Object
Worksheet As Object
End Type

Private Type UserDefinedType2
Connection As Object
Command As Object
Parameter As Object
Recordset As Object
End Type

Option Explicit
Dim Excel(1 To 3) As UserDefinedType
Dim ADODB(1 To 19) As UserDefinedType2

Any solutions?
--
TWN

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default User defined Type

Tried your suggestion Jim...same results, "user defined type not defined".
--
TWN


"Jim Thomlinson" wrote:

try changing
Dim Excel(1 To 3) As UserDefinedType
to
Dim udtExcel(1 To 3) As UserDefinedType

Same deal with ADODB. Both Excel and ADODB are reserved so you don't really
want to use them as variable names...
--
HTH...

Jim Thomlinson


"Trebor" wrote:

I am trying to debug existing code and the following declaration won't work.

Private x2App As Excel.Application

I keep getting an error msg stating "user defined type not defined"

Here is the Type statement I have in the declaration section of my class
module.

Private Type UserDefinedType
Application As Object
Workbook As Object
Worksheet As Object
End Type

Private Type UserDefinedType2
Connection As Object
Command As Object
Parameter As Object
Recordset As Object
End Type

Option Explicit
Dim Excel(1 To 3) As UserDefinedType
Dim ADODB(1 To 19) As UserDefinedType2

Any solutions?
--
TWN

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default User defined Type

Jim, I tried changing the Excel reference to MyPaige and the ADODB to
MyHookUp and got the same error msg. Any other ideas?
--
TWN


"Jim Thomlinson" wrote:

try changing
Dim Excel(1 To 3) As UserDefinedType
to
Dim udtExcel(1 To 3) As UserDefinedType

Same deal with ADODB. Both Excel and ADODB are reserved so you don't really
want to use them as variable names...
--
HTH...

Jim Thomlinson


"Trebor" wrote:

I am trying to debug existing code and the following declaration won't work.

Private x2App As Excel.Application

I keep getting an error msg stating "user defined type not defined"

Here is the Type statement I have in the declaration section of my class
module.

Private Type UserDefinedType
Application As Object
Workbook As Object
Worksheet As Object
End Type

Private Type UserDefinedType2
Connection As Object
Command As Object
Parameter As Object
Recordset As Object
End Type

Option Explicit
Dim Excel(1 To 3) As UserDefinedType
Dim ADODB(1 To 19) As UserDefinedType2

Any solutions?
--
TWN

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default User defined Type

As a guess you have

Option Explicit
Dim Excel(1 To 3) As UserDefinedType
Dim ADODB(1 To 19) As UserDefinedType2

in a module somewhere and your UDT's in the Class??? Then a couple of
things. You can not declare a UDT in a Class. Since your UDT are declared
private you need to have all of the declarations in one module... Try this.
Start a new spreadsheet and add a module to it. Paste the following and it
will compile just fine...

Option Explicit
Dim objExcel(1 To 3) As UserDefinedType
Dim objADODB(1 To 19) As UserDefinedType2

Public Type UserDefinedType
Application As Object
Workbook As Object
Worksheet As Object
End Type

Private Type UserDefinedType2
Connection As Object
Command As Object
Parameter As Object
Recordset As Object
End Type
--
HTH...

Jim Thomlinson


"Trebor" wrote:

I am trying to debug existing code and the following declaration won't work.

Private x2App As Excel.Application

I keep getting an error msg stating "user defined type not defined"

Here is the Type statement I have in the declaration section of my class
module.

Private Type UserDefinedType
Application As Object
Workbook As Object
Worksheet As Object
End Type

Private Type UserDefinedType2
Connection As Object
Command As Object
Parameter As Object
Recordset As Object
End Type

Option Explicit
Dim Excel(1 To 3) As UserDefinedType
Dim ADODB(1 To 19) As UserDefinedType2

Any solutions?
--
TWN



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default User defined Type

Thank you sir, I will try that.
--
TWN


"Jim Thomlinson" wrote:

As a guess you have

Option Explicit
Dim Excel(1 To 3) As UserDefinedType
Dim ADODB(1 To 19) As UserDefinedType2

in a module somewhere and your UDT's in the Class??? Then a couple of
things. You can not declare a UDT in a Class. Since your UDT are declared
private you need to have all of the declarations in one module... Try this.
Start a new spreadsheet and add a module to it. Paste the following and it
will compile just fine...

Option Explicit
Dim objExcel(1 To 3) As UserDefinedType
Dim objADODB(1 To 19) As UserDefinedType2

Public Type UserDefinedType
Application As Object
Workbook As Object
Worksheet As Object
End Type

Private Type UserDefinedType2
Connection As Object
Command As Object
Parameter As Object
Recordset As Object
End Type
--
HTH...

Jim Thomlinson


"Trebor" wrote:

I am trying to debug existing code and the following declaration won't work.

Private x2App As Excel.Application

I keep getting an error msg stating "user defined type not defined"

Here is the Type statement I have in the declaration section of my class
module.

Private Type UserDefinedType
Application As Object
Workbook As Object
Worksheet As Object
End Type

Private Type UserDefinedType2
Connection As Object
Command As Object
Parameter As Object
Recordset As Object
End Type

Option Explicit
Dim Excel(1 To 3) As UserDefinedType
Dim ADODB(1 To 19) As UserDefinedType2

Any solutions?
--
TWN

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
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM
"User-defined type not defined" message in Excel RW1946 Excel Discussion (Misc queries) 0 August 31st 05 12:14 PM
Workspace faux user-defined type not defined Chris S[_2_] Excel Programming 3 November 11th 04 05:51 PM
User-defined data type; Error: Only User-defined types... tiger_PRM Excel Programming 1 July 18th 04 03:32 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 05:24 PM.

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

About Us

"It's about Microsoft Excel"