Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Assigning Color
Is there a way to assign a specific color to a table cell, depending on the
value of the merge field? Say, my UserType field can be of five possible values and I want to color code the table cell that contains this field. Appreciate any help. |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Assigning Color
The following macro looks at the cell at row 1, column 1 and shades the
cell based on a text value. You might adapt it to your needs: Sub Test() Dim oTbl As Word.Table For Each oTbl In ActiveDocument.Tables MsgBox oTbl.Cell(1, 1).Range.Text Select Case Left(oTbl.Cell(1, 1).Range.Text, Len(oTbl.Cell(1, 1).Range.Text) - 2) Case "Apples" oTbl.Cell(1, 1).Shading.BackgroundPatternColorIndex = wdRed Case "Lemons" oTbl.Cell(1, 1).Shading.BackgroundPatternColorIndex = wdYellow Case Else 'Continue case statements up to Case "5" as appropriate End Select Next End Sub |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
cell's background color not printed correctly | Tables | |||
Color Printing | Formatting Long Documents | |||
Color Printing | Page Layout | |||
display one font color on the monitor but print in another | Microsoft Word Help | |||
Default background color in Word | Microsoft Word Help |