Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

color in a text box

Status
Not open for further replies.

hellohello1

Technical User
Jun 30, 2006
110
US
Hello,

I have a Word 2003 text box that is a Merge field from Excel. I would like the Fill Color of the text box to change depending on the value of the box. (The values can be only Red, Yellow, Green or Purple).

For example, this is what I tried:

{ IF { MERGEFIELD "Risk_Issue_KPI_Score" } = "Red" Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 0, 0) }
{ IF { MERGEFIELD "Risk_Issue_KPI_Score" } = "Yellow" Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 0) }
etc

But that is not the right format.

Help!

Thanks,
 
Untested.

Try

Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 0, 0)

you probably need
{ MERGEFIELD "Risk_Issue_KPI_Score" }}
to end your condition. Not sure since I haven't tried it.

Another Victim of the recession
 
thanks for writing.

I was told that I cannot mix VBA language and field constructions in this way.

But I decided if I can't make the text box change color, I made the font color change:

{ IF { MERGEFIELD "Risk_Issue_KPI_Score" } = Red "Red" }{ IF { MERGEFIELD "Risk_Issue_KPI_Score" } = Yellow "Yellow" } etc.

You can't tell from above since I can't use color in this forum, but my "Red" is written in red font. The "Yellow" is written in yellow font, etc.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top