View Full Version : Accessing protected fields via VBA
RalphM123
04-15-2010, 06:48 AM
I have an MS Word document with protected sections. They are protected because I want to force the user to only enter information via my macro code. When the macro runs, it (the macro) is not allowed to update the protected information. How do I get around this?
lucas
04-15-2010, 07:29 AM
In your procedure you have to unprotect the document, then run your code, then reprotect the document.
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:="pwd"
'your code
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, Password:="pwd"
End If
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.