vbams-word

Disable Save prompt when closing Word


I'm trying to make it so that when a user clicks the "X" in the top right corner of a WORD document, the prompt "would you like to save changes?" does not come up and the document is not saved. I have found many solutions for Excel, but I have not been successful trying to apply them to Word...

Thanks in advance for any help!

EDIT: I want this to apply to only one document. The .docm is set up as a ReadOnly (to allow Kill-ing itself); it has 2 buttons, 1 for saving as a .pdf form for retain, and 1 to save as a revision and not a completed form. I want to disable the prompt when someone uses the "X" to force saved revision tracking.


Solution

  • Put this in your ThisDocument Object under MicrosoftWordObjects for the file in question.

    Make sure it doesn't go into the Normal section

    Private Sub Document_Close()
        Me.Saved = True
    End Sub
    

    Putting this in the Normal section will turn off the Save As functionality for all documents you open on your instance of Word.