DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Return cell colorIndex

I know this is possible inside of excel but I was wondering if there is a VBScript that will allow me to check a cell inside of excel and return it's interior colorIndex?

 

 

0 Kudos
Message 1 of 2
(3,288 Views)

Hi aGrimm,

 

You can also get the color with VBScript in DIAdem!  The color returned will be a number, but you can then handle the number to get a color name or whatever else you need to do.

 

Here is the code I used to test this is:

 

 

Dim objExcel, objWorkbook
Dim strFileName
Dim CI

strFileName = "C:\Users\bvaughan\Documents\TestBook.xls"

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open(strFileName)

CI = objExcel.Worksheets("Sheet1").Cells(1, 1).Interior.ColorIndex
MsgBox(CI)

 

Regards,

 

Brandon V.

Applications Engineering

National Instruments

www.ni.com/support

 

 

 

Message 2 of 2
(3,269 Views)