Results 1 to 4 of 4
  1. #1
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Templates and Macros (2000)

    I have created a collection of templates, and a document that acts of a menu for the others.

    In the menu document there are command buttons that create documents based on each of the templates. this all works OK. The templates themselves contain command buttons.

    What I have found is that the command buttons in the documents created from the templates don't work. All the code associated with each button in the template is not carried through to the document created from the template.
    The documents are created using the documents.add method.

    Is that normal?

    I can get around it by turning my templates into documents, and using
    Documents.Open FileName:=currentpath & "name.doc", ReadOnly:=True
    instead, but I wonder if I have any other choices.
    Regards
    John



  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: File/New Templates and File/New Documents 2K

    Hi John
    While I'm not conversant with VBA & someone else may have more information, I can tell you this. When you create a new template, based on a custom template, you copy everything: styles, autotext, modules, toolbars, & shortcut keys. When you create a new document based on a custom template, you only copy styles & autotext.

    I leave it to someone more knowledgeable than I to come up with a solution.
    Cheers,

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Templates and Macros (2000)

    I have revisited these and I find that the command buttons do work after all.

    They don't have any code behind them, instead they use the code in the template.

    It was my trying to look at the code behind them that stopped them working. As soon as I looked, an empty procedure was created.
    Regards
    John



  4. #4
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: File/New Templates and File/New Documents 2K

    Phil

    I have just posted a reply to my own question. It seems that the macros are not copied, just referred to and so still work.

    Thanks
    Regards
    John



Posting Permissions

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