Hi Brad,
You can definitely use conditional formatting to change the font color of the data in your Word table based on the level of risk. Here's how you can do it:
- Select the cells in your table that you want to apply the conditional formatting to.
- Click on the "Home" tab in the ribbon.
- Click on the "Conditional Formatting" button in the "Styles" group.
- Select "New Rule" from the drop-down menu.
- In the "New Formatting Rule" dialog box, select "Use a formula to determine which cells to format".
- In the "Format values where this formula is true" field, enter the formula that corresponds to the level of risk you want to format. For example, if you want to format cells that contain "High", enter the formula "=IF(A1="High",TRUE,FALSE)" (assuming the cell you want to format is A1).
- Click on the "Format" button to choose the font color you want to apply to the formatted cells.
- Click "OK" to close the "Format Cells" dialog box.
- Click "OK" again to close the "New Formatting Rule" dialog box.
Now, any cells in your table that meet the criteria you specified in the formula will be formatted with the font color you chose.
If you want to apply this formatting during autopopulation, you can create a macro that applies the conditional formatting to the appropriate cells based on the data being imported. Here's an example of what that macro might look like:
PHP Code:
Sub ApplyConditionalFormatting()
Dim myTable As Table
Dim myCell As Cell
'Change "MyTableBookmark" to the name of the bookmark for your table
Set myTable = ActiveDocument.Bookmarks("MyTableBookmark").Range.Tables(1)
For Each myCell In myTable.Range.Cells
'Change "IRiskA1" to the bookmark name for the cell you want to format
If ActiveDocument.Bookmarks("IRiskA1").Range.Text = "High" Then
myCell.Range.Font.Color = wdColorRed
End If
Next myCell
End Sub
This macro loops through all the cells in your table and checks the value of the cell corresponding to the "IRiskA1" bookmark. If the value is "High", it applies red font color to the cell.