D
Daniel
Good morning,
I have created a protected form in which there are currently 2 tables.
In the 8th row of the first table I have two check boxes (which by code are
mutually exclusive). However, I would like to control, based on the
selection made, the backcolor of the 9th row (which also happens to be the
last row in the table) of this table. Could someone show me how this is
done?! Below is my non-functional code.
************************************************************
Sub ToggleCheckBoxOnEntry()
Dim fFields As FormFields
Dim fSelectedField As FormField
Set fFields = ActiveDocument.FormFields
For Each fSelectedField In Selection.FormFields
' Form field must be a check box.
If fSelectedField.Type = wdFieldFormCheckBox Then
' Go to the case for the currently selected group.
Select Case fSelectedField.Name
'Check box group.
Case "Chk_Paper", "Chk_Electronic"
' Clear all values.
fFields("Chk_Paper").CheckBox.Value = False
fFields("Chk_Electronic").CheckBox.Value = False
Case "Chk_Original", "Chk_Copy"
' Clear all values.
fFields("Chk_Original").CheckBox.Value = False
fFields("Chk_Copy").CheckBox.Value = False
End Select
' Check the selected formfield.
fSelectedField.CheckBox.Value = True
If fFields("Chk_Electronic").CheckBox.Value = True Then
'fFields("Chk_Original").Enabled = False
'fFields("Chk_Copy").Enabled = False
ActiveDocument.Tables(1).Rows.Last.Select
With Selection
.Cells.Borders.InsideColor = 1
End With
End If
End If
Next
End Sub
************************************************************
Thank you the help,
Daniel
I have created a protected form in which there are currently 2 tables.
In the 8th row of the first table I have two check boxes (which by code are
mutually exclusive). However, I would like to control, based on the
selection made, the backcolor of the 9th row (which also happens to be the
last row in the table) of this table. Could someone show me how this is
done?! Below is my non-functional code.
************************************************************
Sub ToggleCheckBoxOnEntry()
Dim fFields As FormFields
Dim fSelectedField As FormField
Set fFields = ActiveDocument.FormFields
For Each fSelectedField In Selection.FormFields
' Form field must be a check box.
If fSelectedField.Type = wdFieldFormCheckBox Then
' Go to the case for the currently selected group.
Select Case fSelectedField.Name
'Check box group.
Case "Chk_Paper", "Chk_Electronic"
' Clear all values.
fFields("Chk_Paper").CheckBox.Value = False
fFields("Chk_Electronic").CheckBox.Value = False
Case "Chk_Original", "Chk_Copy"
' Clear all values.
fFields("Chk_Original").CheckBox.Value = False
fFields("Chk_Copy").CheckBox.Value = False
End Select
' Check the selected formfield.
fSelectedField.CheckBox.Value = True
If fFields("Chk_Electronic").CheckBox.Value = True Then
'fFields("Chk_Original").Enabled = False
'fFields("Chk_Copy").Enabled = False
ActiveDocument.Tables(1).Rows.Last.Select
With Selection
.Cells.Borders.InsideColor = 1
End With
End If
End If
Next
End Sub
************************************************************
Thank you the help,
Daniel