Re: Class in separate add in?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Jezebel (warcrimes_at_whitehouse.gov)
Date: 02/24/05


Date: Fri, 25 Feb 2005 08:54:32 +1100

You can add a property to the module that instantiates and returns a
reference to the class. Eg the addin called XXX has a class called clsPBar;
in a module in the addin add code like this --

Public Property Get PBarClass() as clsPBar
    Set AddinClass = new clsPBar
End Property

Then any module with a reference to the addin can use

    With XXX.PBarClass
        ....

You'll need to modify the property code if you don't want to instantiate a
new class object with every call -- eg if you have just one instance shared
by all callers.

"Chuck" <Chuck@discussions.microsoft.com> wrote in message
news:52D806DF-18FD-44EE-B53E-034950127A86@microsoft.com...
> I'm trying to get my head around classes ... ideally I'd like to create
> add
> ins that contain code used by a variety of subs in other add ins. I'm
> using
> a progress bar form as my learning tool -- for instance ideally any sub in
> any add in would be able to call up the progress bar from a single
> dedicated
> add in; the alternative seems to be to copy the progress bar code to every
> add in.
>
> Is it possible to use a class that exists in a different add in? When I
> set
> up a class in one add in and add a reference to it in second, the second
> only
> sees the first's modules and ThisDocument. Do I need to create a sub in a
> module in the first add in that allows the second to manipulate the class
> in
> the first?
>
> Apologies if this is a murky question. Any guidance much appreciated...
>
> Should I be creating mac



Relevant Pages

  • Re: Class in separate add in?
    ... you have to have a reference to it. ... > calling macro now. ... >> You can add a property to the module that instantiates and returns a ... Eg the addin called XXX has a class called ...
    (microsoft.public.word.vba.general)
  • Re: Auto Load Add-In
    ... you posted that will unload the addin. ... Sub ListAddins() ... Dim adn As AddIn ... I also assume the reason you want to add a project reference to the addin to ...
    (microsoft.public.excel.programming)
  • How to trap "Cant find project or library" error messages
    ... Do not reference the addin via Tools/References in the VBE. ... Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, ...
    (microsoft.public.excel.programming)
  • Re: Auto Load Add-In
    ... adding a reference in the VBE from Tools> References is completely to ... Perhaps all you need to do is load the addin as a normal workbook, ... I tried the sub loadAddIn() below IN CODE #1 and I get ERROR #1. ... Dim tempStr As String ...
    (microsoft.public.excel.programming)
  • Re: Separation of API and implementation
    ... by not passing 'y' as a reference to B::foo at all. ... Here some Client accesses B::foo. ... virtual void doIt; ... When whoever instantiates the R3 association provides a reference when invoking B::setR3, that reference must be a B or else the compiler will have a kitten. ...
    (comp.object)