
; ********************************************************************************
; *
; * Excel OLE Sample
; *
; ********************************************************************************                                                 

objXL = ObjectCreate("Excel.Application")

objXL.Visible = @TRUE

Workbooks=objXL.WorkBooks
Workbooks.Add

Numbers="One Two Three Four Five Six Seven Eight Nine Ten"
offset=1
row=0

:ROWLOOP
col=0
row=row+1
if row > 10 then goto byebye
strValue=ItemExtract(row,Numbers," ")
colIndex=row+offset

;Column Heading
Cells1=objXL.Cells(1, colIndex)
Cells1.Value=strValue
;Add special properties
myfont = Cells1.Font
myfont.FontStyle = "BOLD"
myfont.size = 12
myfont.ColorIndex = 3 ; RED

;Row Heading
Cells1=objXL.Cells(row+1, 1)
Cells1.Value=strValue
;Add special properties
myfont = Cells1.Font
myfont.FontStyle = "BOLD"
myfont.size = 12
myfont.ColorIndex = 3 ; RED

:COLLOOP
col=col+1
if col > 10 then goto ROWLOOP
;Sets values of cells
strValue=row*col
Cells1=objXL.Cells(row+offset, col+offset)
Cells1.Value=strValue
;Add special properties
myfont = Cells1.Font
myfont.FontStyle = "BOLD"
myfont.size = 10

goto COLLOOP

:byebye
objXL = 0
Message("WinBatch OLE Sample","Complete")

