07-08-2015 01:28 AM
with Font>Color I can set the font color in Excel using activeX, my question is how to set the background color, or called fill color of a cell of the entire row/column with activeX, thx in advance.
07-08-2015 02:49 AM
The fill colour of a cell or a range of cells is changed using the Colorindex or Color property of the Range.Interior object.
ColorIndex required an integer 1-56 representing a colour from the default colour pallette
Color expects a long integer usually generated by the RGB(Red, Green, Blue) function in Excel
Good Luck
Ken
07-08-2015 03:00 AM
Thanks a lot!
do you have a document help to know how to set all property of Excel, just as below (some example):
单元格设定背景色
objExcelSheet.Cells(3.1).Interior.colorindex=17
合并单元格
objExcelSheet.Range(“A1:G7”).Merge
07-08-2015 03:13 AM
My development strategy is to write (or record) a VBA Macro which does what I want it to do, using the Excel Help as a reference to methods and properties thatI am unfamiliar with, then convert it to LabVIEW AxtiveX. I dont think that there is a help document in LabVIEW.
Ken
07-08-2015 07:56 AM
ELI2011 wrote:
do you have a document help to know how to set all property of Excel
That's like asking someone to explain every feature of a programming language. I agree with the record a macro, then replicate the code in LabVIEW method.
There have been several toolkits wrote for Excel, the Report Generation Toolkit is pretty decent, and now comes with LabVIEW 2014 (I think Full and Pro). Or there are some older toolkits like this one that still have value and is free.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
07-08-2015 08:11 AM
The Report Generation Toolkit is only available for free in LabVIEW Pro. In LabVIEW Full its still an add on at £430![]()
07-08-2015 09:32 PM
it`s great, thanks!
07-09-2015 09:36 PM
excuse me, can you help to parse following Macro to LabVIEW? THX!
Sub Macro1()
'
' Macro1 Macro
'
'
Range("R10").Select
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, _
Formula1:="=12"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Color = -16383844
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 13551615
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Rows("12:12").Select
ActiveWindow.FreezePanes = True
End Sub
07-10-2015 02:28 AM
Thats a complicated set of instructions to have LabVIEW carry out!
Are you wanting to do this multiple times or just once per run. If doing this only once per run, say during initialisation or setup of your Excel worksheet, I would apply all the formatting in Excel and save it as a template and then open the template from LabVEIW.
Ken