The Dirty property returns or specifies a value that determines whether the document was modified after it was last saved.
Examples:
The following VBA example asks the user to save the document if the changes have not been saved, and then closes the document.
Sub Test()
If ActiveDocument.Dirty Then
If MsgBox("Document is modified. Save?", vbOKCancel) = vbCancel Then Exit Sub
ActiveDocument.Save
End If
ActiveDocument.Close
End Sub