![]() |
|
#4
|
||||
|
||||
|
Try:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim CCtrl As ContentControl, i As Long
Dim Pwd As String, pState As Variant
With ActiveDocument
If .ProtectionType <> wdNoProtection Then
Pwd = InputBox("Please enter the Password", "Password")
pState = .ProtectionType
.Unprotect Pwd
End If
With .Range
For i = .ContentControls.Count To 1 Step -1
With .ContentControls(i)
If .Type = wdContentControlCheckBox Then
If .Checked = False Then
.Range.Rows(1).Delete
Else
.Delete
End If
End If
End With
Next
End With
If pState <> wdNoProtection Then .Protect Type:=pState, NoReset:=True, Password:=Pwd
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Auto-populate Text Field When I Click Check Boxes | LobaBlanca | Word VBA | 2 | 03-14-2019 08:10 PM |
| Print documents based on boxes checked in word document | eshiffman | Word VBA | 8 | 04-05-2018 06:26 AM |
| Need to create document that will auto insert text based on parameters | parisfranco | Word | 13 | 07-25-2017 03:21 PM |
| Word document with check boxes | JohnW | Word | 3 | 12-01-2016 07:43 AM |
| Table - Check Boxes - Create Select All | lajohn1963 | Word Tables | 2 | 09-25-2010 11:18 AM |