Results 1 to 13 of 13

Thread: Using Add-ins

  1. #1
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Using Add-ins

    Hi,

    I'm using Word 2000. I've used an add-in the Word startup folder to try to phase out depending on Normal.dot.

    I've successfully been able to move AutoExec and AutoOpen routines to this folder. I have lots of forms with formfields, and many of these have "run macro on exit"- I've been able to get those working OK running from the Addin.

    However, I can't seem to get routine names within the Addin to be recognised from macros running from other templates

    Eg, if I have a macro in the addin called "ComputeSomething", and a template called "Fax", I can't get the code in Fax.dot to recognise the routine "ComputeSomething".

    I've tried to create a reference from Fax to the addin, but I get a message "Name conflicts with existing module, project of object library". I'd rather not have to do that manually to 400 templates either, if I can help it.

    Thanks

    Geoff
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Using Add-ins

    Hi Geoff,

    I can reproduce this behavior by attempting to set a reference to a project to which a reference has already been set.
    Any chance that's what's happening in this case?

    Gary

  3. #3
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using Add-ins

    Gary,

    No, the template is and Addin by virtue of it being in the startup directory. I think that Word is therefore objecting to setting an explicit reference when, by virtue of it being in the Word startup directory, there's already an implied reference.

    Even so, I'd rather be able to reference the routines in the add-in without having to create a reference, if that were possible. I can access them in the on-exit macros, so I'm not quite sure why I can't access them from the VBA code,
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  4. #4
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Using Add-ins

    Geoff,

    It's true when I did my test, it was using an add-in that I had loaded myself, rather than one in Startup.

    (I still think there's a duplicate reference hiding somewhere though - sometimes they're a way down the list and not readily visible...)

    But if what you're saying is true, then here's a possible workaround: deploy the add-in to some other location than Startup. And in Startup, have a template which contains code to load the add-ins.

  5. #5
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using Add-ins

    Have you made the Sub/Function names Public?

  6. #6
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using Add-ins

    Yep.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  7. #7
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using Add-ins

    Gary,

    Would I still have a problem with this approach pointing to the add-in? Or have I missed something about what you're saying?

    Actually, you may be right about the duplicate reference hiding. I can create a new document, and create a reference to the add-in OK. But if I get rid of everything from the
    template (all modules, forms, references and text) I still get an error message.

    I think that I can get around the problem by using "Application.Run macroname:=addinRoutine"- although not as nice, it may work. (Sometimes I have trouble when stepping through a "run" routine, it doesn't return to the calling point).
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  8. #8
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Using Add-ins

    Geoff,

    With regard to the suggestion of pointing to an add-in, rather than a template in Startup - that was just in response to your observation that the problem might have to do with the template being in Startup (although that probably wasn't the cause of the problem).

    Based on your second observation, it does sound like there's something flaky with the template.

    I have to admit I'm still a litle shaky on calling procedures in global templates - for example, I've never had to pass an argument to a procedure in a global template, and am not looking forward to needing to figure out how![img]/w3timages/icons/crazy.gif[/img] (At my firm, a lot of "global" procedures are deployed in every workgroup template that directly needs it, rather than in a global template, so calling the procedure and passing it arguments is quite easy.
    The cost is some added housekeeping and overhead in each template, but it is easier to work with.)

    Gary

  9. #9
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using Add-ins

    Gary,

    Thanks for the response.

    If there's something flaky with the template, it applies to all the templates- not just a single one.

    We've had our global procedures in Normal.dot- the point of this exercise is to move away from that. It's generally worked well- we have a procedure which updates Normal.dot without affecting customised settings. Bur from time to time, Normal.dot gets corrupted (3-5 times per week in 3000 users) and the Help Desk is asking for another way to do things. Having the "global" procedures in 400+ templates is not an option here [img]/w3timages/icons/smile.gif[/img]

    I had gone along the path of a skeleton in Normal.dot pointing to the add-in- but there's an occasional OLE type error which pops up from titme to time, which might bother the Help Desk even more (although it doesn't APPEAR to do any harm). So I'm trying my best to get rid using Normal.dot altogether.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  10. #10
    knoway
    Guest

    Re: Using Add-ins

    Hi Geoff,

    I think we may have similar environments. FWIW, I had problems setting up mine.

    In my archecture, I totally ignore Normal.Dot, allowing users to make local client copies if they wish.

    I also have most of my VBA code in a number of global templates that are referenced (by default) in the startup folder.

    I try to avoid putting any code in "Document Layout Templates".

    However, having said that, code in Document Layout Templates is not a problem unless it references code in the Global Templates, in which case the reference must be recorded between the Document Layout Template and the Global Template.

    If I need a reference, I *always* refer the Document Template to the appropriate Global Templates in one direction only. I *never* relate Document Layout Templates to each other.

    In the early days of setting up this architecture, I didn't always follow these rules, and found that I sometimes got circular references. These gave symptoms similiar to the ones you describe, but were the devil to isolate.

    I don't know if this is in line with what you are trying to do, or not, and I may have misunderstood your problem.

    However, it is another rule of mine to never let a lack of understanding of the facts prevent me from having an opinion. [img]/w3timages/icons/wink.gif[/img]

  11. #11
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using Add-ins

    Dave,

    It sounds good, and is similar to what I want to do (I think).

    But many of the "Document Layout Templates" do have common code. That code used to reside in Normal.dot; I'm now trying to put that code into the Global "Add-in" template.

    Any references are always and only in the layout templates referring to the Add-in (where they have been up to now referring to Normal.dot- which has no references anywhere). I'm having trouble making that reference. I assume you're talking about using "Tools, References" to make the reference. I'd prefer to make a reference to the add-in from the Layout Template without having to even do that- as there's 400+ templates which would need changing, and it's a process I don't think can be automated.

    As well as the explicit calls, I also require every Layout Template to do an AutoNew which is to reside in the Add-in.I was trying to use the DocumentChange event for that- hence my posting in another thread.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  12. #12
    knoway
    Guest

    Re: Using Add-ins

    Hi Geoff,

    I think I understand what you want to do.

    I have to admit that I have not found a way to use VBA, in a global template, without referencing it from the document layout templates using tools|reference in the editor. With 400 templates that is a lot of grief.

    With Office 2000 I believe that it is possible to provide some automation in the VBE, but I don't know any details, and I certainly haven't tried it.

    Another alternative, and one that I am currently working on, is to move the common code into VB6 and compile it into an ActiveX DLL. You still have to register it though, as a COM Add-in, but I suspect that this will be easier than registering in the macro editor.

    So that is my $0.02 worth - happy to help if I can.

  13. #13
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,049
    Thanks
    124
    Thanked 119 Times in 116 Posts

    Re: Using Add-ins

    Geoff,

    Assuming that your global is added first, the following should work

    Application.Run MacroName:="procedurename"

    procedurename is your macro. You can substitute "Word" for Application.

    I believe that in Word 2000 this can also be used for functions but am not sure.

    Hope this helps.[img]/w3timages/icons/grin.gif[/img]
    Charles Kyle Kenyon
    Madison, Wisconsin

Posting Permissions

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