Hi all, We have a change request process that is automated in our Solidworks PDM vault. I have (2) drop downs, with multiple options that, when selected write to custom properties in the Word document. Example wouild be Addition and Class A. I am trying to make a macro will take these custom properties, and based on them, unlock checkboxes for editing, check the corresponding checkboxes in my word document, and lock checkboxes for editing. I have a simple version that works where i specify a property and it finds it and checks the box. I cannot seem to make work where i specify an "array" of the available options and it checks document and selects two boxes. I've attached the code i have so far. Thanks in advance for any guidance!







Sub CheckBoxesByTag()
    Dim propertyName As String
    Dim propertyValue As String
    Dim cb As ContentControl
    Dim tagToFind As String
    ' Define the name of the custom property to check propertyName = "DCR Type"
    ' Define the tag to find tagToFind = "Deviation"  ' Make sure to enclose string values in double quotes
    ' Get the value of the custom property
    On Error Resume Next
    propertyValue = ActiveDocument.CustomDocumentProperties(propertyName).value
    On Error GoTo 0
    ' Check if the custom property exists and has a specific value
    If propertyValue = tagToFind Then
        ' Loop through content controls to find checkboxes and unlock them
        For Each cb In ActiveDocument.ContentControls
            If cb.Type = wdContentControlCheckBox Then
                ' Unlock the content control
                cb.LockContentControl = False
                ' Allow editing of the content control
                cb.LockContents = False
            End If
        Next cb
        ' Loop through content controls to find checkboxes and check them
        For Each cb In ActiveDocument.ContentControls
            If cb.Type = wdContentControlCheckBox And cb.tag = tagToFind Then
                cb.Checked = True
            End If
        Next cb
        ' Loop through content controls to find checkboxes and lock them
        For Each cb In ActiveDocument.ContentControls
            If cb.Type = wdContentControlCheckBox Then
                ' Lock the content control
                cb.LockContents = True
            End If
        Next cb
    End If
End Sub