Sometimes you want to mark a map document as changed so that you will be prompted to save the document when exiting ArcMap. Sometimes you do not want to be prompted to save. This tip shows how to do it.
How to use
- Copy the subroutines to the VBA editor of an opened map document.
- Execute a subroutine.
- Exit the map document and you will be prompted to save the document if you execute the MarkDocChanged subroutine. If you execute MarkDocUnchanged, you will not be prompted to save.
Public Sub MarkDocChanged()
Dim pDocDirty As IDocumentDirty2
Set pDocDirty = ThisDocument
pDocDirty.SetDirty
End Sub
Public Sub MarkDocUnchanged()
Dim pDocDirty As IDocumentDirty2
Set pDocDirty = ThisDocument
pDocDirty.SetClean
End Sub