Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Jan 2004
    Location
    Mount Prospect, Illinois
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Attached Template changes if created from .doc (2002/XP)

    I've built a system of templates with one 'master' template (let's call it joel.dot) and about 200 'content' templates (i.e. cover page.doc, study report.doc) which are all attached to the Master.
    The .doc files are in the local or workgroup template folder so that they're available from File > New > General Templates (called Templates on My Computer in 2003).

    When the new doc is created, it's nicely a "Document3" unnamed doc, and attached to joel.dot.
    Under 2002 SP3 (but not 2003), when the document is saved and reopened, the attached template is listed as "cover page.doc".
    I've tried at the "Immediate" box to explicitly set the Activedocument.attachedtemplate to "joel.dot" prior to saving, and it didn' t seem to make a difference.
    Once opened, if the attached template is changed, it doesn't revert again. It's just the first save that seems to be wrong.

    Has anyone seen this? Might there be a way around it? I haven't tried hooking the SaveFile command.

  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: Attached Template changes if created from .doc

    Hi Joel:
    >>I've built a system of templates with one 'master' template (let's call it joel.dot) and about 200 'content' templates (i.e. cover page.doc, study report.doc) which are all attached to the Master.<<

    Something is wrong with this description. First, although I'm not trying to be nitpicky, a template is attached to a document...not the other way around. I mention this just so we are talking about the same thing. Secondly, your "content templates" are not templates in the Word sense. They may be templates in the sense of providing boilerplate data in a new file, but they aren't templates.

    I'm not positive what you've done, but "cover page.doc" is 1) either a template renamed from a .dot extension to a .doc extension, or 2) it's a document.

    Either way, they will show up in the File/New dialog box. If it's actually a template, then when you create a new document based on it from File/New, the attached template should be listed in Tools/Templates & add-ins as ".../filepath/cover page.doc". It should remain attached. If it's a document, then the attached template will be the one that the "cover page.doc" document is attached to (i.e. joel.dot).

    >>The .doc files are in the local or workgroup template folder so that they're available from File > New > General Templates (called Templates on My Computer in 2003).<<

    That's why they show up under File/New.

    >>When the new doc is created, it's nicely a "Document3" unnamed doc, and attached to joel.dot.<<

    Are you creating the new doc from Joel.dot or from "cover page.doc"? The behavior you describe is what I'd expect if you're creating a new doc from Joel.dot -OR- if "cover page.doc" is a document attached to Joel.dot.

    >>Under 2002 SP3 (but not 2003), when the document is saved and reopened, the attached template is listed as "cover page.doc".<<

    While I don't have Word 2002, I don't know why the attached template should change, unless you are specifically doing something to make it change.

    I'm not quite sure what you're trying to accomplish by having .doc files as templates. You could create documents based on Joel.dot, modify them by copying styles & boiler plate from cover page.doc etc. & save them as templates. If you have macros or autotext in joel.dot that you need for these different types of documents, you could either put them in these new templates themselves or put joel.dot in the Word startup folder, so they would be available globally.

    Hope this helps,

  3. #3
    2 Star Lounger
    Join Date
    Jan 2004
    Location
    Mount Prospect, Illinois
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Attached Template changes if created from .doc

    > I'm not positive what you've done, but "cover page.doc" is 1) either a template renamed from a .dot extension to a .doc extension, or 2) it's a document.
    It's a document.

    > If it's a document, then the attached template will be the one that the "cover page.doc" document is attached to (i.e. joel.dot).
    That's what it's supposed to do... and doesn't after the first save (but if reset later it does stick)

    >I don't know why the attached template should change, unless you are specifically doing something to make it change.
    Nope, no hooks on FileSave or anything like that.

    > I'm not quite sure what you're trying to accomplish by having .doc files as templates.
    Several things
    1) Macros are maintained in only one place, rather than the 200 'content' templates
    2) Macros are only available for documents based on the template (rather than being a global template)
    3) .doc files, when placed in Documentum as their (cough) templates, make more .doc files. .dot files placed in the Templates cabinet of Documentum, make more .dot files (ick)

    Actually, after posting here, I found someone else who had the same problem.
    A certain security hotfix for Office 2002 (and possibly 2003) causes this problem, which is fixable with an AutoNew macro

    Sub AutoNew()
    dim s as string
    s = ActiveDocument.AttachedTemplate.FullName
    ActiveDocument.AttachedTemplate.FullName = NormalTemplate.FullName
    ActiveDocument.AttachedTemplate.FullName = s
    end sub

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

    Re: Attached Template changes if created from .doc

    Hi Joel:
    I'm glad you posted the follow-up. I can see your reason for using docs in the template folder to keep macros in one template & only available to certain documents. You could load Joel.dot as an add-in for only those documents, but it gets a little tricky (at least for me <img src=/S/grin.gif border=0 alt=grin width=15 height=15>). I experimented one time with using an AutoOpen macro to load the add-in & an AutoClose macro to unload it. Trouble was if you had two such documents open & you close one, the template is unloaded.

    I'm curious as to where you found the solution (if you have a link).

    When you said
    >>3) .doc files, when placed in Documentum as their (cough) templates, make more .doc files. .dot files placed in the Templates cabinet of Documentum, make more .dot files (ick)<<

    I'm not sure what you mean. When you either double click or use File/New on a template, you get a document. You shouldn't get another template unless you're opening the template.
    Cheers,

  5. #5
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Attached Template changes if created from .doc

    Hi Joel,

    We had similar problems when we first implemented Documentum. This is the solution that works for us:
    1. ALL code is placed in a code-only template (your joel.dot?) in Word's startup folder
    2. regular templates are placed in the Workgroup templates folder and they contain a CustomDocumentProperty (CDP) "Documentum" with value "YES" if the template is to be used with Documentum
    3. regular templates contain NO code at all, they're just 'boilerplate' templates with FormFields and AutoText entries
    4. 'virgin' docs are created from these templates, meaning that no code is run when created (hold Shift key pressed when creating)
    5. those 'virgin' docs are imported in the Templates cabinet of Documentum
    6. when users do a 'create doc' or 'open doc' from within Documentum, the doc is put in the 'checkout' folder and then Word opens it and finds the attached template in the Workgroup templates folder
    7. in the code-template we use applications events wdApp_NewDocument and wdApp_DocumentOpen which test for CDP "Documentum" to 'know' if it should run the Documentum-relevant code

  6. #6
    2 Star Lounger
    Join Date
    Jan 2004
    Location
    Mount Prospect, Illinois
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Attached Template changes if created from .doc (2002/XP)

    (Edited by HansV to make URL clickable - see <!help=19>Help 19<!/help>)

    The full characterization and cure for this problem was found here

    It's an undocumented side effect of a Microsoft Office hotfix (sic), which is why we've only seen it on a few people's machines, it's only those folks who've bothered to get fully patched that have the problem.

    Joel

Posting Permissions

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