如何在保存excel文件时去掉是否保存的提示?

解决方案 »

  1.   

    不行啊。method saved not suppported by automation object.
      

  2.   

    我是用SERVER组件,你用的是什么?
      

  3.   

    我想直接存一个xls文件。CreateOleObject('excel.application');
      

  4.   

    XlsApp.DisplayAlerts := True;
      

  5.   

    Var
      ExlApp:OleVariant;
    ExlApp:=CreateOLEObject('Excel.Application');
        ExlBook:=CreateOLEObject('Excel.Sheet');
        ExlApp.Visible :=False;// True;
        ExlApp.DisplayAlerts := False;
      

  6.   

    不行啊。method displayalerts not suppported by automation object.
      

  7.   

    我在D5下
    var
       exlApp,et :OleVariant;
    begin
      exlapp:=createOleObject('excel.application');
      exlapp.visible:=true;
      exlapp.workbooks.add(1);
      et:=excelapplication.workbooks[1].worksheets['sheet1'];
      et.cells.item[1,1]:='str';
      et.saveas('c:\a.xls');
    end;
      

  8.   

    var
       exlApp,et :OleVariant;
    begin
      exlapp:=createOleObject('excel.application');
      exlapp.visible:=true;
      exlapp.workbooks.add(1);
      ExlApp.DisplayAlerts := False;
      et:=exlapp.workbooks[1].worksheets['sheet1'];
      et.cells.item[1,1]:='str';
      et.saveas('c:\a.xls');
    倒数第三句有问题,我已在D6下通过。
      

  9.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,//Variants,Excel2000,OleSever,
      Dialogs, StdCtrls,Comobj;type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
      ExcelApplication,Sheet1:Variant;
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.DFM}procedure TForm1.Button1Click(Sender: TObject);
    begin
      try
       excelapplication:=CreateOleObject('excel.application');
      except
        showmessage('sorry,你可能?color="#000000">]有安装Excel');
        abort;
      end;
      Excelapplication.visible:=true;
      Excelapplication.workbooks.add(1);//(xlWBatWorkSheet);
      sheet1:=Excelapplication.workbooks[1].worksheets['sheet1'];
      sheet1.name:='Delphi控制Excel Chat';
      sheet1.Cells.item[1,1]:='Excel Chat 范例';
      sheet1.Cells.item[2,1]:='星期';
      sheet1.Cells.item[2,2]:='星期一';
      sheet1.Cells.item[2,3]:='星期二';
      sheet1.Cells.item[2,4]:='星期三';
      sheet1.Cells.item[2,5]:='星期四';
      sheet1.Cells.item[2,6]:='星期五';
      sheet1.Cells.item[2,7]:='星期六';
      sheet1.Cells.item[2,8]:='星期日';
      sheet1.Cells.item[3,1]:='销售量';
      sheet1.Cells.item[3,2]:=115;
      sheet1.Cells.item[3,3]:=112;
      sheet1.Cells.item[3,4]:=156;
      sheet1.Cells.item[3,5]:=148;
      sheet1.Cells.item[3,6]:=132;
      sheet1.Cells.item[3,7]:=196;
      sheet1.Cells.item[3,8]:=162;
      sheet1.DisplayAlerts := False;  sheet1.saveas('c:\a.xls');
    end;
    end.不行啊。method displayalerts not suppported by automation object.
    D5是否有这个属性啊
      

  10.   

    我的代码是在D6+OFF2000下通过,你的OFFICE是否是2000?
      

  11.   

    sheet1.DisplayAlerts := False;改为
     Excelapplication.DisplayAlerts := False;