Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-22-2013, 06:57 AM
Catty Catty is offline Disabling content controls and protecting document sections. Windows 7 32bit Disabling content controls and protecting document sections. Office 2010 32bit
Advanced Beginner
Disabling content controls and protecting document sections.
 
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Disabling content controls and protecting document sections. VBA to set Content controls as non printing Sammie0Sue Word VBA 21 01-12-2021 04:44 PM
Disabling content controls and protecting document sections. 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
Disabling content controls and protecting document sections. Grouping Content Controls cksm4 Word VBA 2 03-01-2011 12:46 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:01 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft