Undefined User Defined Type at compile time

M

Michel S.

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
 
R

RB Smissaert

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
 
M

Michel S.

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 :
 
M

Michel S.

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é :
 
M

Michel S.

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 :
 

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