Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Mar 2003
    Location
    Elkins Park, Pennsylvania, USA
    Posts
    325
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Procedures in ThisDocument object (Word XP)

    Greetings, all.
    I have inherited some templates from another programmer, and I noticed that she does things differently than I'm used to. Specifically, I've noticed that she stores Document_New(), Document_Open(), and Document_Close() procedures in the ThisDocument object.
    I've never put code in there. When necessary, I create "Auto" modules, but I don't store them there. Can someone explain why someone would want to put code in ThisDocument, and what the differences are between Autonew.Main and the Document_New() procedure I found in hers? (On a side note, I've noticed that our mix of read-only template servers, dynamic menu creation, and Documentum is a sometimes volatile combination. It would behoove me to know exactly what the differences are between our two approaches.)
    Thanks in advance for anyone's help and guidance.
    <font face="Comic Sans MS">That's what you do in a herd; you look out for each other!</font face=comic> - Mike

  2. #2
    Platinum Lounger
    Join Date
    Jan 2001
    Posts
    3,788
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Procedures in ThisDocument object (Word XP)

    Technically macros such as AutoNew are a legacy capability that has been supplanted by their equivalent document event procedures such as Document_New()

    I did a quick search of the MSDN library and the best description I found was an article by Word MVP Bill Coan - Take Control of Microsoft Word Through Events

  3. #3
    3 Star Lounger
    Join Date
    Mar 2003
    Location
    Elkins Park, Pennsylvania, USA
    Posts
    325
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Procedures in ThisDocument object (Word XP)

    Oops. I guess Im dating myself, then. (At least I'm a cheap date!)

    Anyway... one of the problems that I'm seeing, and the reason that practice fell under my suspicious and antediluvian gaze, is that the person who wrote that template has it modifying a menu whenever the template opens.
    No biggie, normally.
    However, our publishing process involves checking docs into our Documentum docbase, and simultaneously sending it over to a PDF server to create a PDF rendition for the docbase. The Documentum/PDF processes are supposed to run unattended. The problem is that the menu change is seen by Word as a modification to the template, and, in spite of the code that is supposed to tell Word that the (changed) template doesn't need to be saved, the whole process stops (on some systems, anyway) while Word waits for a human to tell it what to do with the template.
    And I'm not at liberty to tell it what to do with the template.
    <font face="Comic Sans MS">That's what you do in a herd; you look out for each other!</font face=comic> - Mike

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

    Re: Procedures in ThisDocument object (Word XP)

    Does it help if you, immediately after the menu change, add the line:
    <pre>ActiveDocument.AttachedTemplate.Saved = True</pre>


Posting Permissions

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