Disable Save prompt on Close

J

JHARRIS133

I am trying to disable to Save prompt that appears when a document is closed
in Word 2003. I have found several code samples on the MSDN website, none of
which seem to work. I am writing this code in the Document_Close event. It
could be that the code is correct, but it should be placed somewhere else.
Below are the three variations I have tried to no avail, any assistance would
be greatly appreciated.

ThisDocument.Close SaveChanges :=wdDoNotSaveChanges
Documents(ThisDocument).Close SaveChanges:=wdDoNoSaveChanges
ThisDocument.Close (Word.wdSaveOptions.wdDoNotSaveChanges)

Again, this is to disable the Save prompt when closing the document.
 
J

JHARRIS133

Thanks, that version works...but only when I am debugging and stepping
through the Document_Close() event line by line. I have even put a msgbox
right before the Close event is called to verify that I am there. When I
debug, the message displays, then the document closes. When I run a Close
command from within Word, I still receive the prompt to save.

Do you know what other event could be interfereing here?
 
M

MWK

Try this Thisdocument.Saved=True

This should trick Word into thinking the document has been saved and should
not prompt you to save.
 
M

MWK

I played with this and it will work on existing documents. It doesn't work
if the document has never been saved before.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top