var
    Int_Col,Int_row:integer; //列,行,所选字段的列
begin     Ole_Execl:=Texcelapplication.Create(self);
     Try
         Try
            Ole_Workbook:=Ole_Execl.Workbooks.Add(EmptyParam,0); // 
        Except        End;
        Ole_range:=Ole_Execl.Rows;        For Int_Col:=0 to dxDBGrid2.ColumnCount-1 do
        Begin
             Ole_range.Cells.Item[1,Int_Col+1]:=dxDBGrid2.Columns[int_col].Caption;
        End;
        tbl_lld.First;
        For Int_row:=2 To tbl_lld.RecordCount+1 do
        Begin
            For Int_Col:=0 to dxDBGrid2.ColumnCount-1 do
            Begin
                Ole_range.Cells.Item[Int_row,int_col+1]:=dxDBGrid2.Columns[Int_Col].Field.AsString;
            End;
            tbl_lld.Next;
        End;     Finally
          Try
            Ole_Execl.Save;
            Ole_Execl.Disconnect;
            Ole_Execl.Free;
          except
          end;
     End;
end;

解决方案 »

  1.   

    试试把Ole_Execl.Free
    改为Ole_Execl.quit
      

  2.   

    >>试试把Ole_Execl.Free
    >>改为Ole_Execl.quit然後, Ole_Execl := Unassigned;
      

  3.   

    先ole_Excel.disconnect,然后Ole_Excel.quite
      

  4.   

    Ole_Execl.Disconnect;
    Ole_Execl.Free;
    该为:
    ole_Excel.ActiveWorkbook.Close;
      

  5.   

    Ole_Execl.quit;
    Ole_Execl.Disconnect;
    Ole_Execl.Free;
      

  6.   

    我都用过了,没有用,Excel还是驻留在内存里面