Closing a document without saving and without the Save Dialog box appearing

P

ProbCoder

I have a template with the following code in the AutoClose Macro in
ThisDocument object:

Private Sub AutoClose()
ThisDocument.Saved = True
ThisDocument.AttachedTemplate.Saved = True
End Sub

From what I've researched, this is the way of eliminating the "Do you
want to save changes..." dialog box from appearing. But the box is
still appearing. I am attempting to remove any option to save a
document created from this template. What am I missing?
 
J

Julie

Try the following in a standard code module in the template

Sub FileSave()
'save not allowed
End Sub

Sub AutoClose()
ActiveDocument.Saved = True
ActiveDocument.AttachedTemplate.Saved = True
End Sub

Sub FileSaveAs()
'save as not allowed
End Sub

This would "discourage" a save, but won't completely prevent it. To
completely prevent, further steps are needed such as deal with Save-All
command, prevent user from changing the attached template, etc.
 
P

ProbCoder

Thank you, Julie, that worked. Also added:
Sub FileSaveAsWebPage()
'save not allowed
End Sub
and that worked too. Great concept! Thanks again.
 

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