View Single Post
 
Old 03-14-2024, 08:33 AM
ccamm ccamm is offline Windows 10 Office 2021
Novice
 
Join Date: Mar 2024
Posts: 2
ccamm is on a distinguished road
Default

I have made some progress with this by using case rather than if else as it is a bit cleaner

Code:
Option Explicit

Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
    If ContentControl.Type = wdContentControlDropdownList Then
        If ContentControl.Title = "ROLE" Then 
            ChangeCheckBoxes ContentControl
        End If
    End If
End Sub

Sub ChangeCheckBoxes(ByRef dropdownControl As ContentControl)
    Dim dropdownValue As String
    dropdownValue = dropdownControl.Range.Text
    

    Select Case dropdownValue

        Case "RSC"
            ActiveDocument.SelectContentControlsByTitle("RPT").Item(1).Checked = True
            ActiveDocument.SelectContentControlsByTitle("DS").Item(1).Checked = True
  
            
        Case "LSC" 
   
            ActiveDocument.SelectContentControlsByTitle("DS").Item(1).Checked = True
            ActiveDocument.SelectContentControlsByTitle("SPT").Item(1).Checked = True
     
            
           
                
    End Select
End Sub
I think this should work and I should be able to add onto it, however Its not triggering
Reply With Quote