i knew i forgot something!
Sub AutoOpen() ' Update all fields in the document Dim aStory As Range Dim aField As Field For Each aStory In ActiveDocument.StoryRanges For Each aField In aStory.Fields aField.Update Next aField Next aStory ' Process checkboxes based on custom properties CheckBoxesByTag End Sub Sub CheckBoxesByTag() Dim lngProp As Long Dim arrProperties() As String Dim varValue As Variant Dim oCC As ContentControl ' Define the names of the custom properties to check arrProperties = Split("DCR Type|Change Classification", "|") ' Loop through each property name in the array For lngProp = 0 To UBound(arrProperties) ' Get the value of the custom property varValue = ActiveDocument.CustomDocumentProperties(arrProperties(lngProp)).Value ' If the value is not empty, find the corresponding content control by tag and check it If Not IsEmpty(varValue) Then ' Get the specific content control associated with that value e.g., tag = value Set oCC = ActiveDocument.SelectContentControlsByTag(varValue).Item(1) oCC.LockContents = False oCC.Checked = True oCC.LockContents = True End If Next lngProp lbl_Exit: Exit Sub End Sub






Reply With Quote