Changed document, want to close without prompt to save

  • Thread starter Thread starter Stan Brown
  • Start date Start date
S

Stan Brown

This is *not* a case of getting "Do you want to save changes?" when I
didn't actually make any. Rather, I open a document used by my whole
workgroup, make a few changes, print it, and close it.

I want to *not* be prompted to save when I close this one particular
changed document -- is there any setting I can make?

Word 2003, Win XP Pro
 
A macro such as the following, attached to a toolbar button, would do
what you want:

Sub DoNotSaveChanges()
ActiveDocument.Close savechanges:=False
End Sub

If you need assistance, see http://gmayor.com/installing_macro.htm.

Of course, if it is run on the wrong document, the macro will cause a
loss of data, so use it with care!

--
Stefan Blom
Microsoft Word MVP


in message
news:[email protected]...
 
Tue, 20 Jun 2006 15:14:52 +0200 from Stefan Blom
in message
A macro such as the following, attached to a toolbar button, would do
what you want:

Sub DoNotSaveChanges()
ActiveDocument.Close savechanges:=False
End Sub

If you need assistance, see http://gmayor.com/installing_macro.htm.

Of course, if it is run on the wrong document, the macro will cause a
loss of data, so use it with care!

Thanks, Stefan. I'm a little reluctant to create such a toolbar
button, because of just the risk you cite. Is there nothing in the
GUI to accomplish this same result? I couldn't find anything, but I'm
hoping against hope that it's there and I just missed it.
 
A minor addition to Stefan's macro will limit the macro to the one document.

Sub DoNotSaveChanges()
Dim strName As String
strName = ActiveDocument.Name
If strName = "Document name.doc" Then
ActiveDocument.Close savechanges:=False
End If
End Sub

Where Document name.doc is the name of the document in question. For all
other docs the macro does nothing.
Any global changes would have the same problems as the original macro.

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Back
Top