Sub CheckBoxesByTag()
Dim propertyNames As Variant
Dim propertyValue As Variant
Dim cb As ContentControl
Dim tagToFind As Variant
Dim propertyName As Variant
' Define the names of the custom properties to check
propertyNames = Array("DCR Type", "Classification")
' Loop through each property name in the array
For Each propertyName In propertyNames
' Get the value of the custom property
'On Error Resume Next
propertyValue = ActiveDocument.CustomDocumentProperties(propertyName).Value
'On Error GoTo 0
' Define the tag to find
tagToFind = Array("Addition", "Deviation", "Change", "Removal", "Class A", "Class B", "Class C", "Class D")
' Make sure to enclose string values in double quotes
' Check if the custom property exists and has a specific value
If Not IsEmpty(propertyValue) And propertyValue = tagToFind Then
' Loop through content controls to find checkboxes with the specified tag
For Each cb In ActiveDocument.ContentControls
If cb.Type = wdContentControlCheckBox And cb.tag = tagToFind Then
' Unlock the content control
cb.LockContentControl = False
' Allow editing of the content control
cb.LockContents = False
' Check the checkbox
cb.Checked = True
' Lock the content control
cb.LockContents = True
End If
Next cb
End If
Next propertyName
End Sub
error 13 type mismatch