none
weird crash with type declaration

    Frage

  • Hi,I'm eperimenting a very weird problem with Word 2010.

    I have an abstract class and several inherited classes who are implementing it.

    If in a regular module I declare a var as

    Public obj as IclsMyAncestor

    is fine;

    BUT if I declare

    Public Type MyType_UDT

    ......

    obj as IclsMyAncestor

    end type

    Public MyVar as MyType_UDT

    the next time I open the word file the program crashes!

    Isn't it very strange?

    Lauro


    • Bearbeitet Lauro2 Mittwoch, 14. März 2012 07:05
    Mittwoch, 14. März 2012 07:04

Alle Antworten

  • Hi Lauro,

    Thank you for posting.

    I try to reproduce your scenario on my side, but it does not happen like this. I used the following code snippet:

    Type MyType_UDT
        obj As Object
    End Type
    
    Public MyVar As MyType_UDT
    

    You can test whether it can work on your side. I'm don't know how did you declare the IclsMyAncestor class?

    How about add New before the class?  If this does not help you, can you give more details about the class you referenced?  I will try to reproduce it on my side.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us

    Freitag, 16. März 2012 09:28
  • Hi Bruce,

    I have very appreciated your interest in my question and I'm very sorry that I didn't reply to you for long time.

    I don't know exactly what happens.

    I tried to reproduce the problem from scratch and I didn't succed. [I created two simple classes, one an inherited interface from the other and declared the global variables in the two mentioned ways and no problem in either ways never arise.]

    So I don't know what to think.

    But more then one time I saw that just rebuild the project, importing again all the modules save from "unexplicable" problems.

    Cheers, Lauro

    Donnerstag, 29. März 2012 19:23