Hello,
I have been working on having some automation to the tables at my new workplace. Basically one content control(Amiante1) is used to select whether abestos is present or not and if it is, what kind of asbestos is present.
Depending on the first content control, the 2nd one(Conc1) either picks a concentration value or N/A.
I've been trying to figure out if there was a way to change the background color of the entire line to yellow only if a type of asbestos is selected.
Here is what I've been using, inspired by another script I found here and butchered to get something that works for me!
1 to 3 are placeholder text/Not detected/not analyzed. 4 to 7 are types of asbestos.
Any help would be greatly appreciated!
Code:
Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean)
Application.ScreenUpdating = False
Dim oCC As ContentControl
Dim i As Integer
With CCtrl
Select Case .Title
Case "Amiante1"
Set oCC = ActiveDocument.SelectContentControlsByTitle("Conc1").Item(1)
If .ShowingPlaceholderText = False Then
For i = 1 To 3
If .DropdownListEntries(i) = .Range.Text Then
oCC.Range.Text = .DropdownListEntries.Item(i).Value
Exit For
End If
Next i
Else
oCC.Range.Text = ""
End If
Case Else
End Select
End With
lbl_Exit:
Set oCC = Nothing