• Doc or Dot? (WinXP/Word2003 NL)

    Author
    Topic
    #424203

    At our company there’s a pilot project using Documentum (DOC) as a document management system. From DOC, Word documents can be created based on our house-style templates. I’m told that for that purpose it’s necessary to import those templates into the DOC database. Handling documents created from DOC, through VBA code shows some strange behaviour every now and then. A little investigation shows that these documents, although the have a .doc extension, are in reality templates: ActiveDocument.Type returns the value 1, which stands for wdTypeTemplate. One of the things handled by VBA code is enabling/disabling buttons on custom commandbars that might be present in a template. Example: a button to remove a chunk of text is only enabled when there is something to remove. When closing, this could lead to a question like ‘The template has changed, do you want to save?’. In order to avoid that, these enabling/disabling actions are always followed by a line ActiveDocument.AttachedTemplate.Saved = True. But in case of these DOC files, being disguised templates, that also means that ActiveDocument.Saved is set to True… So I have a few questions:
    1) Is importing the templates themselves in Documentum the right thing to do, or should that be fresh, empty documents based on the templates?
    2) Could the fact that setting ActiveDocument.AttachedTemplate.Saved to True also sets ActiveDocument.Saved to True, lead to not saving such a document when the command ActiveDocument.Save is executed? It looks like this command doesn’t save the described DOC documents, but does save documents based on the same templates but created outside DOC.
    3) If the answer to 2) is No, what else could cause the described behaviour?
    4) Another weird thing (to me) is that Word sometimes seems to loose control over which document is the ActiveDocument. If I’m editing my code-only template and for testing purposes open another document, ? ActiveDocument.Name in the Immediate window returns the name of the code template instead of the name of the opened document. Activating that document and typing something and then repeating the command in the Immediate window still returns the name of the code template. Any explanation for this behaviour and, hopefully, a solution?

    In order to exclude some possibillities, I already tried rebuilding the code template from scratch, exporting all modules and importing them into a new empty template.

    Viewing 1 reply thread
    Author
    Replies
    • #973546

      I’ve never used Documentum. In my experience with document management systems, they don’t really understand what you’re putting into them at a deep level, and they don’t integrate with File>New. However, they do let you create a “read-only” library of “forms,” which typically would be documents rather than templates (because you open a copy rather than creating a new file). In any event, renaming DOT templates to DOC documents is not a good thing for the import function to be doing. Perhaps Documentum has more explicit support for Word templates that you can take advantage of?

      On #2, I believe that Word ignores Save when a document has no unsaved changes. It might be necessary to switch to SaveAs with the same file name. If I recall correctly, this changes some of the document statistics (e.g., creation date), but assuming your DMS has event tracking, this shouldn’t really be much of an issue.

      On #4, I hate when the ActiveDocument is not what I expect it to be. But I wonder whether it is reliable to use the Immediate Window for confirmation? How about creating a short keystroke macro to MsgBox ActiveDocument.Name? Assuming that you still get mixed results, I’m not sure what’s going on. Even if a template is open in a document window, I still think it should count as an active document when it has the focus.

    • #973910

      For better or for worse, we have been using Documentum at the company where I work for years now. I’ll put in my two cents regarding some of your questions:
      1) Documentum’s concept of “templates” is not the same as Word’s; in Documentum, templates are simply boilerplate documents. Therefore, my opinion is that you should only be importing DOC files (i.e. Word documents) not Word templates. Leave the templates on a specified server/share and make sure that the users’s machine can “see” the templates that are associated with the documents stored in Documentum. (The only reason I can see to import an actual Word template into Documentum would be to archive it for a lifecycle management sort of purpose.)
      4) I have experienced the same problem as you in my own code, and I found that the best approach is not to rely on “ActiveDocument” at all, but rather to assign a variable to a document as it is opened, e.g. Set myDoc = Documents.Open(FileName:=filetoopen), and then to refer to the document as myDoc. I don’t know why Word “loses track” of the ActiveDocument, but the method I described has been infinitely more reliable.

      • #975541

        thankyou Jefferson & Mike.
        Sorry for the late response; I enjoyed a surprise vacation in the sun! yum

        I’ll ask the projectteam to import empty docs based on the templates instead of the templates themselves and see if that cures the problems we’re experiencing.

        As for using myDoc instead of ActiveDocument, it’s not always possible because ALL VBA code is contained in a global code-only template and not in the attached template of a document (these are just boilerplate templates). And in case the user has more then 1 document open, there’s no way I know of to “know” which document the code must be applied to, other than the ActiveDocument, when the user clicks a button on a commandbar that’s sitting in the global template.

        • #988918

          The issue with templates disguised as documents rings a distant bell. I worked for a firm that used PCDocs and imported their Word templates into it. Unfortunately, Docs didn’t understand the difference and always gave the templates a .doc extension. The best you could do was copy it when you wanted a new document based on it, but what you got was a copy of the template (regardless of the extension). Then we had a *bunch* of faux-documents. Biggest problem with that is that templates don’t have the same set of properties that documents do and we were getting corrupted “documents” all over the place. We had to hunt them down (yikes!) and run a little VBA routine on them to turn them into documents.

          So I’m with Mike — keep your templates out of your document management system, and enjoy every sandwich. grin

          Kim

          • #988977

            Thanks Kim. It also reminded me to post back the results.
            The project team did replace the imported .dot files in Documentum with empty .doc files based on that templates, as Mesaka advised, and that worked fine on our Test system during tests in oktober. But when deployed on our Production system a month later, things went wrong. Only yesterday (!) they finaly understood what was going on: Word 2003 could not find the attached templates of the .doc files, even though these templates were sitting in the workgroup templates folder! So it attached Normal.dot instead. Investigation brought to light that the .doc files were created on the Test system and during roll-out copied to the Production system and there imported in the Production version of the Documentum database. On the Production system the workgroup templates folder is different from the one in Test (T:Prod… vs T:Test…). Re-creating the .doc files from the templates on the Production system and importing them in the database solved the problem.
            That’s logical, I hear you say, and they should have done that in the first place. True!
            But in another, but similar document-database system exactly the same process as described worked fine! Word 97 and 2003 always found the appropriate workgroup templates folder (in the current environment), it didn’t make any difference in which environment (Development, Test, Production) the .doc files were created. We still have no idea why Word behaves differently in both situations.

    Viewing 1 reply thread
    Reply To: Doc or Dot? (WinXP/Word2003 NL)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: