View Single Post
 
Old 02-15-2022, 09:56 AM
dyb dyb is offline Windows 11 Office 2019
Novice
 
Join Date: Feb 2022
Posts: 7
dyb is on a distinguished road
Question Unprotect sections in a word document using VBA

I have a word document template which is protected and want to unprotect some of the individual sections in the document so that the text can be edited. I found an old post on VBA express by Greg Maxey that almost does what I want but it is for unprotecting the sections to allow Form Field data entry.

Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oFld As FormField
ActiveDocument.Unprotect
ActiveDocument.Protect wdAllowOnlyReading
For Each oFld In ActiveDocument.Sections(2).Range.FormFields
oFld.Range.Editors.Add wdEditorEveryone
Next
lbl_Exit:
Exit Sub

End Sub

How would I adapt this to work for text in the sections as this is not a form so does not use form fields.

Any help would be greatly appreciated.
Reply With Quote