Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Jul 2001
    Location
    Edison, New Jersey, USA
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts

    %Include functionality? (MSWord 2000/ WIN XP)

    I have a bunch of templates that contain macros. There are many statements that are common among these macros. When I have to change one of these common statements, I usually have to go into each template/macro and repeat the change.

    Does VBA macro language provide a methodology for pulling in a set of statements from a separate file at execution time? I want to be able to make my changes in 1 place in such a manner that all of my templates/macros will pick up that change.

    VBA has an Insert File feature (which seems to be a paste function to me) - if that was an Insert File LINK feature as is supported in MSWord, that would be great. Any ideas?

    Thanks for your help.

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: %Include functionality? (MSWord 2000/ WIN XP)

    VBA does not have that capability. Put the common code in a separate Function/Sub and put that in Normal.dot. Then call the code from all the places where you need it.
    Legare Coleman

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: %Include functionality? (MSWord 2000/ WIN XP)

    If this is to be used by others than yourself, an add-in/global template (i.e. a .dot file in the Startup folder for Word) is a better place for shared code than Normal.dot. It's easy to replace a global template, but you wouldn't want to overwrite other users' customizations in their Normal.dot.

  4. #4
    Star Lounger
    Join Date
    Jul 2001
    Location
    Edison, New Jersey, USA
    Posts
    89
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: %Include functionality? (MSWord 2000/ WIN XP)

    Thanks for the help, guys. I suspect I need to rethink my approach. What was a doc-by-doc solution is just getting too maintenance heavy for a weekend codior like me. I obviously need the multiple templates for the base content, but maybe I can restructure ALL of the macro functionality - there are more similarities than differences and those differences don't seem to overlap too much. I just have a nagging thought that one of my very first 'solutions' involved a Glogal Template but I moved away from that for some reason. My grey matter has trouble with the details 'cause I only touch this stuff every couple of years.

    I need to research a better solution involving a Global Template (others in my office use these templates and macros)... Thanks again for the clarification and direction.

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

    Re: %Include functionality? (MSWord 2000/ WIN XP)

    If you have VB 6, or some other language that allows you to create ActiveX DLLs, the right way to do things is to put the code in one, or more, ActiveX DLL.s
    Then all each template need have is stub code to call the code in the DLL(s) and Project Reference for each needed DLL.

    Note that DLLs are great, especially if one compiles with Binary Compatibility.

    If you do not have a means to create DLLs, then isolate your code in global templates in Word's startup directory.
    NEVER put code in the Normal template, other than stubs that call code in DLLs or other templates.

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: %Include functionality? (MSWord 2000/ WIN XP)

    The dark side of developing DLLs on your "real work" computer is the need to re-register them in the Registry. In developing one COM Add-in, I think I polluted two screens worth of the Registry and I'm not sure my Add/Remove Programs dialog ever fully recovered. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

Posting Permissions

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