Results 1 to 6 of 6
  1. #1
    4 Star Lounger
    Join Date
    Apr 2001
    Posts
    482
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Global Templates prompt to save at exit (VBA Word 2000)

    I've got code that uninstalls and deletes an existing global template (if it exists) and the installs another version of the same file.

    When I go to close Word, it asks if I want to save my changes to that global template, and quite often other unassociated global templates. Any idea why this happens and if I can/should get rid of this behavior?

    Thanks!!
    Troy

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Global Templates prompt to save at exit (VBA Word 2000)

    You are treading the same water we all treaded before you floated along....

    Don't you just hate that message?

    Anyway, your code IS changing the templates mentioned. Don't argue. Word will not listen.

    To workaround this problem either:

    1) find the code that is changing the template and remove it, comment it out, change it, etc. Good Luck.
    2) for each template set the template.saved property to true in the, ah.... let's see, the DocumentClose event of the template: ThisDocument.AttachedTemplate.Saved = True

    You can also use the FileExit sub (if you have one of your own).
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  3. #3
    4 Star Lounger
    Join Date
    Apr 2001
    Posts
    482
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Global Templates prompt to save at exit (VBA Word 2000)

    Actually, I thought I had seen this somewhere in my wanderings, but could not find it again.

    However, I can't figure what is changing the template.

    I also tried using the close event, but that does not work either. If you can believe the online help, it says:

    "If the event procedure is stored in a template, the procedure will run when a new document based on that template is closed and when the template itself is closed (after being opened as a document)."

    Neither of these is the case, since I am only using the global template to add a custom menu and a host of macros. No document has this attached, nor is the template opened as a document. So, unless I'm misunderstanding, adding that is useless.

    Perhaps a better way to handle this is to save all open templates prior to ending my installation of the global template. Then the user is not confused by the prompt to save the template right after he/she has installed it.

    If you have a different solution, please let me know.

    Thanks!!
    Troy

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

    Re: Global Templates prompt to save at exit (VBA Word 2000)

    Troy,

    It definitely sounds like a better idea to save any relevant templates, at the end of the install, rather than wait until Word is closing.

    If you do have to have code run when Word is closing, I think an AutoExit sub in a (loaded) global template would be the place to put it.

    Gary

  5. #5
    4 Star Lounger
    Join Date
    Apr 2001
    Posts
    482
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Global Templates prompt to save at exit (VBA Word 2000)

    Unfortunately, as I said in the previous post, that code does not run at all.

    And when tested using the close event, I found that the close event did not happen until after I was prompted to save.

    I think OK for now. I have code that will save during install so that user will not be prompted at that point. If they are prompted later, I don't think that will be as bad.

    Thanks again!!
    Troy

  6. #6
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Global Templates prompt to save at exit (VBA Word 2000)

    Gary mentioned the AutoExit sub. That doesn't fire either??!! That *should* work no matter what. Sounds like something else is amiss.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

Posting Permissions

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