'Color
index automation
Option
explicit
Dim
oex, owb, ows, i
'launch excel application
Set
oex=createobject("Excel.Application")
oex.Visible=true 'set excel as visible
'goto excel workbook
Set
owb=oex.Workbooks.Add
'goto worksheet
Set
ows=owb.Worksheets("sheet1")
For
i=1 to 56 step 1
ows.cells(i,1)="Abdhul
Kalam" 'fill first row first
column with some data
ows.cells(i,1).font.bold=true 'set as bold
ows.cells(i,1).font.size=12 'to set data size
ows.cells(i,1).font.colorindex=i 'change color from 1 to 56
Next
'autofit cells
ows.rows.autofit
ows.columns.autofit
'save and close excel software
owb.SaveAs("F:\1.xls") 'use save for
existing file and save as for existing file
oex.Quit
'destroy objects
Set ows=nothing
Set owb=nothing
Set oex=nothing
No comments:
Post a Comment