Controlling when a document is saved in MS Word 2003

J

JHARRIS133

I am trying to build functionality of a document that can be locked by a user
by clicking on a Lock button. When the user clicks on the Lock button, the
Save functionality should be disabled. I have successfully accomplished this
with the Save button/command, but am running into problems when the user
simply closes the document, because if it has been changed, then a save
prompt will appear and allow the user to circumvent the logic in the FileSave
event.

The code I found on MSDN was this:
Documents(ThisDocument).Close SaveChanges:=wdDoNotSaveChanges

This code appears to be the solution that will allow me to place it into the
Document_Close event, so that when the document is closed, it will not save
any changes. However, there is a syntax error in the above statement,
according to the error message I have received. As the "ThisDocument"
statement displays the correct document name, and the rest of the syntax was
copied verbatim, I cannot find the error. I would appreciate any help in
solving this error. Thanks!
 

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