• Using class in add in (2002 sp-2)

    Author
    Topic
    #393845

    In Java, I can do
    include somclass.*
    and then reference the class routines in my code.

    I want to do the same in Excel, Can I

    I have an addin, SomeAddin.xla
    The addin has a class MyClass with a routine DoIt.

    From the VBA IDE, I went to Tools, References, and selected SomeAddin, but I cannot see the classes. Am I asking too much of a Microsoft Product?

    PS, I wrote SomeAddin.xla. If there is a step I need to take to expose the classes, I can go back and to it.

    Thanks in advance.
    Thanks.

    Viewing 0 reply threads
    Author
    Replies
    • #717260

      Are you speaking of code that is in CLASS MODULES or am I missing something?

      Steve

      • #717316

        You are correct
        I want to

        Dim m_SomeClass as new SomeClass

        Sub Tryme()
        m_SomeClass.DoIt
        End Sub

        Where SomeClass in in SomeAddin.xla.

        • #717336

          Are you looking for the command to:
          INSERT – class modules?

          If not I am not sure what your question is? what are you trying to do? I do NOT use Java, so I have no background to what you do in Java.

          Steve

        • #717337

          Are you looking for the command to:
          INSERT – class modules?

          If not I am not sure what your question is? what are you trying to do? I do NOT use Java, so I have no background to what you do in Java.

          Steve

        • #717342

          Hereis some code and discussion from Chip Pearson which outlines how to use class modules with application events.

          Steve

          • #717358

            What I am trying to do is reuse code. I have written an add in. The add in includes several class modules. I want to use the code I have already written, rather than rewritting. I also want inheritance and overloading, but I already know Excel does not offer that with version 2002

            I create a new workbook. I add a module to the new workbook. I add a reference to my add in, SomeAddin via the “Tools, References” I go to the Object Browser and view the objects available to me, which are sheets and modules.

            Now I see that I need to set an Instancing property of the Class Module to PublicNotCreatable.. Once I do this, the class in the XLA is exposed to the other workbook.

            Therefore I have answered my own question.

            Thanks for the help.

          • #717359

            What I am trying to do is reuse code. I have written an add in. The add in includes several class modules. I want to use the code I have already written, rather than rewritting. I also want inheritance and overloading, but I already know Excel does not offer that with version 2002

            I create a new workbook. I add a module to the new workbook. I add a reference to my add in, SomeAddin via the “Tools, References” I go to the Object Browser and view the objects available to me, which are sheets and modules.

            Now I see that I need to set an Instancing property of the Class Module to PublicNotCreatable.. Once I do this, the class in the XLA is exposed to the other workbook.

            Therefore I have answered my own question.

            Thanks for the help.

        • #717343

          Hereis some code and discussion from Chip Pearson which outlines how to use class modules with application events.

          Steve

      • #717317

        You are correct
        I want to

        Dim m_SomeClass as new SomeClass

        Sub Tryme()
        m_SomeClass.DoIt
        End Sub

        Where SomeClass in in SomeAddin.xla.

    Viewing 0 reply threads
    Reply To: Using class in add in (2002 sp-2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: