Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, California, USA
    Posts
    67
    Thanks
    0
    Thanked 1 Time in 1 Post

    Document_New fails when template is used (Word 97 SR-2)

    Does anyone know why Document_New would suddenly stop working for all custom templates in a given Word session?

    Our in-house templates contain code in Document_New to display the dialogs for those templates. This has worked fine for several years. But now we're running into situations where the dialogs stop displaying.

    E.g., I create several documents based on our templates, each template showing the appropriate dialog. Then I create another document based on one of those same templates, and no dialog displays. After that, I can't get a dialog to display, regardless of which in-house template I choose. I have to exit Word and re-start it to get the templates working again.

    This problem is occasional and unpredictable, but is being reported by more and more of our users. So far, I can't relate it to any change in our environment.

    Can anyone suggest any possible causes, or fixes? Thanks!

    Bob

  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: Document_New fails when template is used (Word 97 SR-2)

    <P ID="edit" class=small>Edited by jscher2000 on 28-Jun-02 20:02.</P>Does the event fire if you create a second document without closing the first? In other words, does it really fire when the template is loaded, or when a document based on the template is created?

    I guess we can rule out Word's macro security if it works sometimes on the same machine.

    My only similar experience with event sinks suddenly ignoring events involves Outlook 2000. If I end up in the VBE for some reason during my session, my event handler often stops working until I re-enable it. (I added this to my custom menu along with my macros, it happened often enough.)

  3. #3
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Document_New fails when template is used (Word 97 SR-2)

    Bob,

    Sorry don't have a solution; just wanted to say that I've seen the same thing in both Word 97 and Word 2000: like you, we often have Document_New procedures that culminate in the showing of a userform (dialog).

    When the userform displays, the user can fill it in and click OK to create the document, or they can click Cancel, in which case the userform unloads and the new document gets closed without saving.

    Sometimes, but not always, if the user clicks Cancel to unload the userform and close the document, if they then immediately try to create a new document based on the same template again, the new document is created but the code in Document_New does not run at all. (And same as in your case, they then need to quit/relaunch Word to get it to behave.)

    It's as if the action of unloading the userform and closing the new document without saving, is setting some sort of global flag in Word that prevents Document events from firing.

    But we've never been able to track down the source of the problem.
    Nor have we been able to think up a workaround for this behavior.

    Gary

  4. #4
    Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, California, USA
    Posts
    67
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Document_New fails when template is used (Word 97 SR-2)

    The event does fire when I create a second document without closing the first. You're right about macro security, too, since we're using the same settings we've been using all along.

    Thanks for the post. I'll keep digging...
    <img src=/S/crossfingers.gif border=0 alt=crossfingers width=17 height=16>

  5. #5
    Star Lounger
    Join Date
    Feb 2001
    Location
    San Francisco, California, USA
    Posts
    67
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Document_New fails when template is used (Word 97 SR-2)

    Gary,

    Thanks for the response.

    I've tried Cancelling and then immediately creating another document based on the same template. Doesn't seem to keep the dialogs from opening in this case.

    I'm kind of glad to hear you say you don't know the cause or a workaround. I've spent a lot of time researching this and am SO ready to move on to other things (like, maybe,actually writing some code...)

    Thanks again.

    Bob

Posting Permissions

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