View Single Post
 
Old 02-01-2023, 06:45 PM
elaineAda elaineAda is offline Windows XP Office 2010
Novice
 
Join Date: Mar 2019
Posts: 25
elaineAda is on a distinguished road
Default macro to close document without saving but password protected

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
Reply With Quote