From: JeffG on
I need to take an action when the user presses the X in the upper right
corner on a document that has been modified but not saved. Preferably, I
would like to do this after the Word query to save or not has been answered
with a yes.

Could anyone show me how to accomplish this?

From: Graham Mayor on
There is no way to force this on a user as it requires macros and you cannot
force a user to run macros if he chooses not to. However you could add an
autoclose macro to the document template to force a save if the document in a
loop that will continue until the document is saved:

Sub AutoClose()
Start:
If Not ActiveDocument.Saved Then
Dialogs(wdDialogFileSaveAs).Show
If Not ActiveDocument.Saved Then
MsgBox "Document must be saved before closing!"
GoTo Start
End If
End If
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>



"JeffG" wrote:

> I need to take an action when the user presses the X in the upper right
> corner on a document that has been modified but not saved. Preferably, I
> would like to do this after the Word query to save or not has been answered
> with a yes.
>
> Could anyone show me how to accomplish this?
>