I want to add this code to ThisDocument
in my Word .docm file.
Sub AutoClose()
ActiveDocument.Saved = False
End Sub
The code prevents the "Do you want to save?" dialog from appearing. I only want to add this however after a certain click event in the document, because I also have Save As
and Save
disabled, and if I add all three, then I wouldn't be able to save the document myself. (In fact, I can't add all three, for that reason.)
If I add the above code only to be active after the last click event in the document however it should be fine, since then I can still save changes I make, as long as I haven't clicked that trigger at the end yet. Preventing people from closing and getting the "Do you want to save?" dialog at the end is the most important to me.
is there a way to write the above code to ThisDocument when another click event fires? Or put another way, is there any way to have a click event put the above code into effect?
Here's the sub at the end that I'd want to have trigger the above code to (activate? Be written? Be enabled? Be uncommented?)
Private Sub formatSaveB_Click()
ActiveDocument.Bookmarks("mark3").Select
Selection.Delete
ActiveDocument.InlineShapes(1).Delete
With Dialogs(wdDialogFileSaveAs)
.Format = wdFormatFilteredHTML
.Show
End With
End Sub
So after that event happens, I want
Sub AutoClose()
ActiveDocument.Saved = False
End Sub
to be active in ThisDocument -- but not before that event.