Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Aug 2001
    Location
    Campbell River, Br. Columbia, Canada
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts

    troubleshooting template & macros (W2000 SR1, Win9

    I am having trouble figuring out how to save the macros I created for a specific template for use on another computer.

    Here's the story:

    As a favor for a friend, I created a template containing several macros. I also created a new toolbar with custom-made icons for those macros. (She has the same version of Word as I do and her computer is networked with 5 other computers in her office.) I copied the template onto a diskette and then on her computer, I put it her C:WindowsApplication dataMicrosoftTemplates folder. When I opened the template on her machine, it looked perfect. The toolbar and icons showed up as planned. (I was worried that the icons I made wouldn't "survive the trip".) However, none of the macros work.

    As a precaution against this eventuality, I had copied the macros as a .bas file on the same diskette by clicking Tools > Macros > Visual Basic Editor > File menu > Export File. Once I discovered the macro problem, I import the .bas file into her Visual Basic. Naturally, ALL my macros were imported but the custom icons still wouldn't work.

    Now here are my questions:

    How can I make sure the macros will be available to the template on her computer?

    How can I delete the macros that DON'T belong to that template?

    I'd sure appreciate any help you can offer.

    - Wyza

  2. #2
    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: troubleshooting template & macros (W2000 SR1, Win9

    Have you double-checked the macro security settings to see if they are disabling the macros in the original template? It's difficult to think of any other explanation...

    As for the toolbar, if you move the macros, you need to reassign the toolbar buttons. Trying to get the template working would be best, but you can use the Immediate window to change the buttons in a pinch. Here's a sample session, querying the current macro assignment and then making a new assignment in the form ModuleName.ProcedureName:

    <pre>?commandbars("tester").Controls(1).OnAction
    Module1.PasteAway

    commandbars("tester").Controls(1).OnAction = "docCheck.DocReveal"

    ?commandbars("tester").Controls(1).OnAction
    docCheck.DocReveal

    commandbars("tester").Controls(1).Execute</pre>

    You might think that it would be important to specify which project/template the procedure is in, but I guess that would only be needed in the case of a naming conflict. I wasn't able to test that out. Now that I think about it, it might be relevant to your situation if you imported a module with the same name into your friend's Normal.dot template. Hmmm...

  3. #3
    Star Lounger
    Join Date
    Aug 2001
    Location
    Campbell River, Br. Columbia, Canada
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: troubleshooting template & macros (W2000 SR1, Win9

    I forgot to mention that I did check her security settings and changed them from High to Medium so I could access the macros.

    I don't know what a "Module", "Procedure", "Query" or "Session" is so I can't really follow your instructions. Sorry, but could you simplify it a bit? I really appreciate your time and help.

    Could it be that I saved the macros in my Normal.dot but not in the special template? If so, how would I make them available to that .dot?

    Thanks again.

  4. #4
    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: troubleshooting template & macros (W2000 SR1, Win9

    Well, let's start at the top level. In VBA, a template, which is considered a project, can contains one or more modules. Modules are the code windows in which you create your macros.

    You can move macros from a module in one template/project to a module in another template/project using either of two methods: Toos|Macro|Macros...|Organizer... or manual copy and paste. In this case, you might want to use the manual copy and paste method so that you can avoid any confusion about where the macros end up. Generally speaking, to use either method, you just need to open the relevant .dot file; Normal.dot is always available without opening it directly. In the VB Editor, you can use the Project Explorer window to move around among your modules.

    I realize this is a bit skimpy, but a step-by-step is beyond the scope of a Lounge post. You might want to review the Office Developer documentation on MSDN (see below) or the FAQs at the MVPs.org site.

    Modules: What they are and how they work

    Use the Microsoft Visual Basic Editor

  5. #5
    Star Lounger
    Join Date
    Aug 2001
    Location
    Campbell River, Br. Columbia, Canada
    Posts
    65
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: troubleshooting template & macros (W2000 SR1, Win9

    Thanks so much. That explains a lot. I wil check out the links you suggested. You were very helpful.

Posting Permissions

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