Alan said:
To be clear, all I want to do is have a drop-down list in a table
cell, automatically change the color of the table cell based on the
selection, and have it print out without any drop-down list graphics.
Content controls seem to fit the bill, if I can determine how
to trigger off the change in them.
Thanks, Alan
Instead of the macro in the previous reply, put this one into the
ThisDocument module of the template:
Private Sub Document_ContentControlOnExit( _
ByVal ContentControl As ContentControl, _
Cancel As Boolean)
With ContentControl
If .Tag = "Risk" Then
If .Range.Text = "High" Then
.Range.Cells(1).Shading.BackgroundPatternColor _
= wdColorRed
Else
.Range.Cells(1).Shading.BackgroundPatternColor _
= wdColorLightGreen
End If
End If
End With
End Sub
This is an "event handler", which Word automatically calls when the cursor
moves out of any content control. The parameter "ByVal ContentControl" tells
the macro which content control the cursor moved out of. (It should be noted
that the event handler isn't called immediately when the dropdown is
changed, only when the cursor leaves the control.)
The first If statement determines whether the current content control is the
one whose tag is "Risk". If it is, then the value of the dropdown is tested
and the color is set accordingly.
In this version, instead of coloring the cell at a specific row and column
number, it colors whatever cell contains the content control -- that is, the
first (and only) cell in the range of the content control. That way, if rows
or columns are added or removed, the macro will still color the correct
cell.
--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.