Thursday, 30 January 2014

Color Index in Excel with QTP

COLOR INDEX in Excel



HI Guyz, Hope you enjoy the below simple colourful program to get the COLOR INDEX in Excel

Note:  The default color index numbers are 1-56

Option explicit
Dim exo, wbo, wso, i
'open new excel file sheet using VBScriptSet exo=createobject("excel.application")
Exo.visible=true
Set wbo=exo.workbooks.add
Set wso=wbo.worksheets("sheet1")
 'perform getting color index using VBScript
For i = 1 to 56 step 1
        wso.cells(i,1)= "COLOR"
        wso.cells(i,1).font.colorindex= i
        wso.cells(i,1).font.bold=true   
        wso.cells(i,1).font.name="verdana"
        wso.cells(i,1).font.size=15
        wso.cells(i,2).interior.colorindex=i
        Next
'save excel file and close application
Wso.rows.autofit
Wso.columns.autofit
Wbo.saveas ("C:\Documents and Settings\qa\Desktop\cOLORiNDEX.XLS")
Exo.quit
Set wso=nothing
Set wbo=nothing
Set exo=nothing

No comments:

Post a Comment