![]() |
|
#4
|
||||
|
||||
|
For a protected document using checkbox content controls as depicted in your sample, you would need code like:
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
With .Range.Rows(1)
.Range.Delete
.Delete
End With
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 |
| Macro Needed to Delete Unneeded Answers in Multiple Choice Format Question | frustrated teacher | Word VBA | 6 | 05-02-2014 03:37 AM |
multiple choice question
|
ENEMALI | Word VBA | 1 | 09-29-2013 09:05 PM |
Creating a multiple choice test
|
McDoug | Office | 2 | 10-19-2012 10:02 AM |
Linking multiple choice questions to answers
|
Microsoftenquirer1000 | Word | 2 | 08-12-2012 02:49 PM |
| Linking multiple choice questions to answers | Microsoftenquirer1000 | Word | 1 | 06-11-2012 06:53 AM |