View Single Post
 
Old 11-22-2013, 06:57 AM
Catty Catty is offline Windows 7 32bit Office 2010 32bit
Advanced Beginner
 
Join Date: Nov 2013
Posts: 39
Catty is on a distinguished road
Default Disabling content controls and protecting document sections.

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