我用D6+win2000+excel200;
在程序中ole excel:
procedure TForm1.BitBtn1Click(Sender: TObject);
var
begin
   MsExceL:=CreateOleObject('Excel.Application');
   For i:=0 to (ListView1.Items.Count -1) do
   begin
     If ExtractFileExt(ListView1.Items[i].Caption)='.xls' then
     begin
      MsExceL.WorkBooks.open(ListView1.Items.Item[i].Caption);
      MsExceL.Visible:=false;
      MsExceL.WorkSheets[1].Activate;
     end;
   end;
   .
   .
   .
end;procedure TForm1.BitBtn2Click(Sender: TObject);
begin
 if BitBtn2.Caption='关闭' then
 begin
  close;
 end;
 if BitBtn2.Caption='完成' then
 begin
  MSExceL.Quit;
  MSExceL:=unassigned;
  //MSExceL:=NULL;
  BitBtn2.Caption:='关闭';
 end;
end;问题是excel以释放,但在系统进程中还有excel.exe,cpu=00;
怎么把Excel从系统进程中去掉?

解决方案 »

  1.   

    if not varisempty(ExcelApp) then
        ExcelApp.Quit;
      ExcelApp := Unassigned;
    不过还得看你的EXCEL的设定是否为关闭前提醒
    要是不提醒的话,就直接关了。。
      

  2.   

    断开Excel,quit只是简单的关闭Excel应用程序,disconnect才是真正断开同Excel COM服务器的连接,试试
      ExcelApplication1.Quit;
      ExcelApplication1.Disconnect;
    不好意思记不太清了。
    如果对记着给分。
      

  3.   

    feibob(灵猫) 
    if not varisempty(ExcelApp) then
        ExcelApp.Quit;
      ExcelApp := Unassigned;也不行呀!
      

  4.   

    实在不行的话,编一个专门关闭excel进程的函数吧。:),我就这么做过。
      

  5.   

    编一个专门关闭excel进程的函数吧;
    进程我一无所知