var
  xlApp:variant;
begin
  xlApp:=CreateOleObject('Excel.Application');
  .
  .
  .
  xlApp.Quit;
  xlApp:=unassinged;
endi write these code above,bug Excel can't terminated,why?
my excel is Excel2000

解决方案 »

  1.   

    Try
        {创建OLE对象:Excel Application与WorkBook}
        ExlApp:=CreateOLEObject('Excel.Application');
        ExlApp.DisplayAlerts := False;
      Except
        showMessage('您的机器里未安装Microsoft Excel');
       Exit;
      end;
     ExlApp.Visible := true;
       ExlApp.DisplayAlerts := False;
      ExlApp.workBooks.Open(exl);
      ExlApp.Workbooks[1].WorkSheets[1].PrintPreview;
      exlapp.workbooks.close;
      exlapp.quit;
      

  2.   

    可能是有WORKSHEET  和 WORKBOOK  未关闭,先关闭,再disconnet,然后quit
      

  3.   

    最后加
     ExlApp := unassinged;