Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


OLE and Excel - Spreadsheet Calculation Example

Keywords: 	   excel spreadsheet calculation

; Performs a calculation in an Excel spreadsheet.

;------------------------------
amount  = "50.00"
taxrate = ".0865"
;------------------------------

Book = ObjectOpen("Excel.Sheet")
Sheet = Book.ActiveSheet
CellA1 = Sheet.Range("A1")
CellA2 = Sheet.Range("A2")
CellA3 = Sheet.Range("A3")

CellA1.Value = amount
CellA2.Value = taxrate
CellA3.Formula = "=A1*A2"

tax = CellA3.Value

ObjectClose(CellA3)
ObjectClose(CellA2)
ObjectClose(CellA1)
ObjectClose(Sheet)
ObjectClose(Book)

Message("Tax", tax)

Article ID:   W14281
Filename:   OLE and Excel - Spreadsheet Calculation.txt