错误提示:Undeclared identifier:"createOleObject"源码:
procedure TForm1.Button1Click(Sender: TObject);
var
 eclApp,WorkBook:olevariant;
 xlsFileName:string;
 i,j:integer;
begin
 xlsFileName:='c:\lzm.xls';
 try
  eclApp:=CreateOleObject('Excel.Application');
  WorkBook:=CreateOleObject('Excel.Sheet');
 except
  Application.MessageBox('你的机器没有安装Microsoft Excel','使用Microsoft Excel',MB_OK+MB_ICONWarning);
  Exit;
 end;
 try
   WorkBook:=eclApp.workbooks.Add;
   for i:=0 to DBGrid1.Columns.Count-1 do
    begin
      eclApp.Cells(1,i+1):=DBGrid1.Columns[i].FieldName;
    end;   DBGrid1.DataSource.DataSet.First;
   j:=2;
   while not DBGrid1.DataSource.DataSet.Eof do
    begin
     for i:=0 to DBGrid1.DataSource.DataSet.FieldCount-1 do
     begin
      eclApp.Cells(j,i+1):=DBGrid1.DataSource.DataSet.Fields[i].Value;
    end;
    DBGrid1.DataSource.DataSet.Next;
    inc(j);
   end;  WorkBook.SaveAS(xlsFileName);
  WorkBook.close;
 except
   on E:Exception do
    showmessage(E.Message);
  end;
end;