Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Mar 2002
    Location
    Western NY, USA
    Posts
    157
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Using class in add in (2002 sp-2)

    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.

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Using class in add in (2002 sp-2)

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

    Steve

  3. #3
    2 Star Lounger
    Join Date
    Mar 2002
    Location
    Western NY, USA
    Posts
    157
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using class in add in (2002 sp-2)

    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.

  4. #4
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Using class in add in (2002 sp-2)

    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

  5. #5
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Using class in add in (2002 sp-2)

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

    Steve

  6. #6
    2 Star Lounger
    Join Date
    Mar 2002
    Location
    Western NY, USA
    Posts
    157
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using class in add in (2002 sp-2)

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •