home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 March / Chip_2002-03_cd1.bin / sharewar / winbatch / winbatch.exe / ExcelOLE.wb_ < prev    next >
Encoding:
Text File  |  2001-11-02  |  1.3 KB  |  62 lines

  1.  
  2. ; ********************************************************************************
  3. ; *
  4. ; * Excel OLE Sample
  5. ; *
  6. ; ********************************************************************************                                                 
  7.  
  8. objXL = ObjectOpen("Excel.Application")
  9.  
  10. objXL.Visible = @TRUE
  11.  
  12. Workbooks=objXL.WorkBooks
  13. Workbooks.Add
  14.  
  15. Numbers="One Two Three Four Five Six Seven Eight Nine Ten"
  16. offset=1
  17. row=0
  18.  
  19. :ROWLOOP
  20. col=0
  21. row=row+1
  22. if row > 10 then goto byebye
  23. strValue=ItemExtract(row,Numbers," ")
  24. colIndex=row+offset
  25.  
  26. ;Column Heading
  27. Cells1=objXL.Cells(1, colIndex)
  28. Cells1.Value=strValue
  29. ;Add special properties
  30. myfont = Cells1.Font
  31. myfont.FontStyle = "BOLD"
  32. myfont.size = 12
  33. myfont.ColorIndex = 3 ; RED
  34.  
  35. ;Row Heading
  36. Cells1=objXL.Cells(row+1, 1)
  37. Cells1.Value=strValue
  38. ;Add special properties
  39. myfont = Cells1.Font
  40. myfont.FontStyle = "BOLD"
  41. myfont.size = 12
  42. myfont.ColorIndex = 3 ; RED
  43.  
  44. :COLLOOP
  45. col=col+1
  46. if col > 10 then goto ROWLOOP
  47. ;Sets values of cells
  48. strValue=row*col
  49. Cells1=objXL.Cells(row+offset, col+offset)
  50. Cells1.Value=strValue
  51. ;Add special properties
  52. myfont = Cells1.Font
  53. myfont.FontStyle = "BOLD"
  54. myfont.size = 10
  55.  
  56. goto COLLOOP
  57.  
  58. :byebye
  59. ObjectClose(objXL)
  60. Message("WinBatch OLE Sample","Complete")
  61.  
  62.