Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Undefined User Defined Type at compile time
Hello,
Upon compiling a VBA Excel 2003 project, I get the message "Undefined User Defined Type" in an Ok/Help box. There's no highlighted code line at all to help me find where the compiler found this. I'm not using UDTs at all, and, AFAIK, all required librairies are referenced, and none is maked as "Missing" in the references list. Any idea on how to pinpoint the souce of this problem ? Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Undefined User Defined Type at compile time
If you haven't done it yet put Option Explicit at the top
of every module (normal modules, forms and classes) and then compile again. RBS "Michel S." wrote in message ... Hello, Upon compiling a VBA Excel 2003 project, I get the message "Undefined User Defined Type" in an Ok/Help box. There's no highlighted code line at all to help me find where the compiler found this. I'm not using UDTs at all, and, AFAIK, all required librairies are referenced, and none is maked as "Missing" in the references list. Any idea on how to pinpoint the souce of this problem ? Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Undefined User Defined Type at compile time
Thanks for your reply.
Unfortunately, I double-checked that every module has a "Option Explicit" statement, eliminating this as a probable cause of my prob;em. Still open to other suggestions. RB Smissaert a présenté l'énoncé suivant : If you haven't done it yet put Option Explicit at the top of every module (normal modules, forms and classes) and then compile again. RBS "Michel S." wrote in message ... Hello, Upon compiling a VBA Excel 2003 project, I get the message "Undefined User Defined Type" in an Ok/Help box. There's no highlighted code line at all to help me find where the compiler found this. I'm not using UDTs at all, and, AFAIK, all required librairies are referenced, and none is maked as "Missing" in the references list. Any idea on how to pinpoint the souce of this problem ? Thanks |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Undefined User Defined Type at compile time
Not sure it was the problem but :
- I exported the last two modules I worked on - I reimported them in a backup copy I made just before the edits I made above And now everything compile and works well.. Interesting things : - After I imported the first file (a form with code behind), I tried a compile and got the "Undefined User Defined Type" message again, but this time, a code line was highlighted : a Dim variable AS classInstance. That class was the second file I had not imported yet. After importing the second file, not compile error at all. Then I recalled that in the edits I made in the first place, one of them was to change the class name, both the class module name (in its properties sheet) and in the Dim and Set statements (AS class name) in the other module. These two modules are highly interrelated in that the class module raise events that are sunken by the form module. The class module is declared "WithEvents" in the form module. Is it possible that VBA went confused by that change and corrupted my project ? Le 2007-03-18, Michel S. a supposé : Thanks for your reply. Unfortunately, I double-checked that every module has a "Option Explicit" statement, eliminating this as a probable cause of my prob;em. Still open to other suggestions. RB Smissaert a présenté l'énoncé suivant : If you haven't done it yet put Option Explicit at the top of every module (normal modules, forms and classes) and then compile again. RBS "Michel S." wrote in message ... Hello, Upon compiling a VBA Excel 2003 project, I get the message "Undefined User Defined Type" in an Ok/Help box. There's no highlighted code line at all to help me find where the compiler found this. I'm not using UDTs at all, and, AFAIK, all required librairies are referenced, and none is maked as "Missing" in the references list. Any idea on how to pinpoint the souce of this problem ? Thanks |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Undefined User Defined Type at compile time
It sounds you need the CodeCleaner:
http://www.appspro.com/Utilities/CodeCleaner.htm RBS "Michel S." wrote in message ... Not sure it was the problem but : - I exported the last two modules I worked on - I reimported them in a backup copy I made just before the edits I made above And now everything compile and works well.. Interesting things : - After I imported the first file (a form with code behind), I tried a compile and got the "Undefined User Defined Type" message again, but this time, a code line was highlighted : a Dim variable AS classInstance. That class was the second file I had not imported yet. After importing the second file, not compile error at all. Then I recalled that in the edits I made in the first place, one of them was to change the class name, both the class module name (in its properties sheet) and in the Dim and Set statements (AS class name) in the other module. These two modules are highly interrelated in that the class module raise events that are sunken by the form module. The class module is declared "WithEvents" in the form module. Is it possible that VBA went confused by that change and corrupted my project ? Le 2007-03-18, Michel S. a supposé : Thanks for your reply. Unfortunately, I double-checked that every module has a "Option Explicit" statement, eliminating this as a probable cause of my prob;em. Still open to other suggestions. RB Smissaert a présenté l'énoncé suivant : If you haven't done it yet put Option Explicit at the top of every module (normal modules, forms and classes) and then compile again. RBS "Michel S." wrote in message ... Hello, Upon compiling a VBA Excel 2003 project, I get the message "Undefined User Defined Type" in an Ok/Help box. There's no highlighted code line at all to help me find where the compiler found this. I'm not using UDTs at all, and, AFAIK, all required librairies are referenced, and none is maked as "Missing" in the references list. Any idea on how to pinpoint the souce of this problem ? Thanks |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Undefined User Defined Type at compile time
Thanks !
It took a couple of retries (Excel crashed when modules were exported in the same directory as the xls file), but it finally cleaned the project correctly since there are no longer suspect compile errors. Thanks again ! MS RB Smissaert a exposé le 2007-03-19 : It sounds you need the CodeCleaner: http://www.appspro.com/Utilities/CodeCleaner.htm RBS "Michel S." wrote in message ... Not sure it was the problem but : - I exported the last two modules I worked on - I reimported them in a backup copy I made just before the edits I made above And now everything compile and works well.. Interesting things : - After I imported the first file (a form with code behind), I tried a compile and got the "Undefined User Defined Type" message again, but this time, a code line was highlighted : a Dim variable AS classInstance. That class was the second file I had not imported yet. After importing the second file, not compile error at all. Then I recalled that in the edits I made in the first place, one of them was to change the class name, both the class module name (in its properties sheet) and in the Dim and Set statements (AS class name) in the other module. These two modules are highly interrelated in that the class module raise events that are sunken by the form module. The class module is declared "WithEvents" in the form module. Is it possible that VBA went confused by that change and corrupted my project ? Le 2007-03-18, Michel S. a supposé : Thanks for your reply. Unfortunately, I double-checked that every module has a "Option Explicit" statement, eliminating this as a probable cause of my prob;em. Still open to other suggestions. RB Smissaert a présenté l'énoncé suivant : If you haven't done it yet put Option Explicit at the top of every module (normal modules, forms and classes) and then compile again. RBS "Michel S." wrote in message ... Hello, Upon compiling a VBA Excel 2003 project, I get the message "Undefined User Defined Type" in an Ok/Help box. There's no highlighted code line at all to help me find where the compiler found this. I'm not using UDTs at all, and, AFAIK, all required librairies are referenced, and none is maked as "Missing" in the references list. Any idea on how to pinpoint the souce of this problem ? Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBAProject name compile error, not defined at compile time | Excel Programming | |||
Help: Compile error: type mismatch: array or user defined type expected | Excel Programming | |||
Workspace faux user-defined type not defined | Excel Programming | |||
User-defined data type; Error: Only User-defined types... | Excel Programming | |||
Word.Document - user defined type not defined | Excel Programming |