![]() |
|
#1
|
|||
|
|||
|
Hi,
I am creating a macro to disable certain sections of a document (document has a lot of content controls and thus have to disable them aswell). After running this macro, my doc is still not protected. Any idea what I'm doing wrong? Below is the code. Code:
Sub DisableDoc()
'locking the content controls
Dim ofmfld As FormField, CCtrl As ContentControl
With ActiveDocument
For Each ofmfld In .FormFields
ofmfld.Enabled = False
Next
For Each CCtrl In .ContentControls
CCtrl.LockContentControl = False
Next
End With
Selection.InsertBreak Type:=wdSectionBreakContinuous
ActiveDocument.Sections(1).ProtectedForForms = False
ActiveDocument.Sections(2).ProtectedForForms = True
ActiveDocument.Sections(3).ProtectedForForms = True
ActiveDocument.Sections(4).ProtectedForForms = True
ActiveDocument.Sections(5).ProtectedForForms = True
ActiveDocument.Sections(6).ProtectedForForms = True
End Sub
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
VBA to set Content controls as non printing
|
Sammie0Sue | Word VBA | 21 | 01-12-2021 04:44 PM |
Content Controls
|
Sammie0Sue | Word | 6 | 11-06-2013 10:56 PM |
| Using both rich and plain content controls in one document | Erica.Black | Word | 0 | 06-18-2013 10:33 AM |
| Macro to link 2 content controls | bortonj88 | Word VBA | 2 | 08-21-2012 06:24 AM |
Grouping Content Controls
|
cksm4 | Word VBA | 2 | 03-01-2011 12:46 PM |