Hi Hi
I have problem writing a code to close a document but with password protected without saving if user does not want to save.
This code is not able to password protect if user decides not to save the file and exit word.
Code:
Private Sub Document_Close()
With ActiveDocument
If .ProtectionType = wdNoProtection Then
.Protect wdAllowOnlyReading, NoReset:=True
Else
.Unprotect
End If
End With