Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Sep 2003
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    AutoClose and Document_Close Don't... (O97-SR2a & Win98 SE)

    Background: I have a template ("base template") that automates 6 other templates ("sub templates"). These sub templates are actually MailMerge main documents.

    The base template contains a UserForm with which the user selects the appropriate merge to perform. The base template then creates a new document (merge document) based on the selected sub template, attaches the data source to the merge document and executes the merge to a new document. The base template then closes all the open documents except for the resultant form letter and returns control to the user.

    I need to prevent the user from saving the form letter document, so I removed all the buttons, menu items and key bindings from the form letter document.

    Trouble is, when the user modifies the form letter document and then tries to close it, they are presented with the option to save the changes.

    Question: How do I prevent Word from giving the user the option to save their changes?
    What I have tried: Through code, I

  2. #2
    Guy Havers
    Guest

    Re: AutoClose and Document_Close Don't... (O97-SR2a & Win98 SE)

    Would it be possible to leave the user with one 'Discard' button. Beneath it could be the code

    ActiveDocument.Close (savechanges = False)

    Just an idea

    Guy

  3. #3
    New Lounger
    Join Date
    Sep 2003
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AutoClose and Document_Close Don't... (O97-SR2a & Win98 SE)

    Indeed, I've thought about that, but here are my concerns...
    1) If the Document_Close() code does not run, will a CommandBarButton's code run? I dunno, I'll give it a try.
    2) This won't work if the user closes the document using the document window's system menu.
    I suppose I could disable the system menu...and all the standard close menus and key bindings and provide my own Close button, but I don't know that I want to go there...but that just might work.
    Thanks!

  4. #4
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AutoClose and Document_Close Don't... (O97-SR2a & Win98 SE)

    A "FileClose" routine will intercept the menu selection File, Close
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  5. #5
    New Lounger
    Join Date
    Sep 2003
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AutoClose and Document_Close Don't... (O97-SR2a & Win98 SE)

    Geoff,
    You're correct. However, I've removed the item from the toolbars and menu bars and even the key bindings. And a FileClose procedure does not seem to run when the user closes a changed document...at least not in this project.

Posting Permissions

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