ExcelApp, WorkBook: variant;
ARow, ACol: Integer;
// SUM()所在Cell
begin
Row, EndRow: Integer;
// SUM起迄行
ExcelApp := CreateOLEObject('Excel.Application');
WorkBook := ExcelApp.Workbooks.Add;
// =SUM($1:$4) 列ACol从1到4行合计
ExcelApp..Cells[ARow, ACol].Formula
:= '= SUM($' + IntToStr(begin
Row) + ':$' + IntToStr(EndRow) + ')';