下面是調用一個已經存在的Excel文件
uses comobj;
procedure TForm1.Button1Click(Sender: TObject);
var v,st,sp,sk,sf:variant;
begin
v:=createoleobject('excel.application');
v.visible:=true;
v.workbooks.add('c:/jzxt/report/style.xls');
st:=v.workbooks[1].worksheets[1];
sp:=v.workbooks[1].worksheets[2];
sk:=v.workbooks[1].worksheets[3];
st.cells[1,1]:='上午好';
sp.cells[1,1]:='中午好';
sk.cells[1,1]:='下午好';
end;