LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel: How do I change the text color in a cell. Using ActiveX functions in CVI?

I'm sending data to a worksheet, and would like to change the font color in a particular cell.

CVI 5.5.1
0 Kudos
Message 1 of 2
(2,942 Views)
OK,
I solved my problem.

I created a macro in Excel, and call that macro out of CVI.

If there is another way please respond.

**** Here is the Code for the macro:

Sub ChangeFailColorText()
'change text color to RED 'FAIL'
'Test summary

For c = 3 To 5 'columns
For r = 6 To 33
'make sure cell text is black
Cells(r, c).Font.Color = RGB(0, 0, 0)
With Worksheets("TestSummary").Cells(r, c)
If .Value = "FAIL" Or .Value = "fail" Then
Cells(r, c).Font.Color = RGB(255, 0, 0)
End If
End With
Next r
Next c

End Sub
0 Kudos
Message 2 of 2
(2,942 Views)