我想打开一个已经存在的excel表,但是出现了错误:Not enough actual parameters!
各位大哥大姐帮忙看看这个是什么错误啊!谢谢  相关代码如下:ExcelApplication1.Visible[0]:=True;
    ExcelApplication1.Caption:='Excel Application';
    try
        excelapplication1.Workbooks.Open(opendialog1.FileName,
        null,null,null,null,null,null,null,null,null,null,null,null,0);
    except
    begin
        ExcelApplication1.Disconnect;//出现异常情况时关闭
        ExcelApplication1.Quit;
        showmessage('请选择EXCEL电子表格!');
        exit;
    end;

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      if opendialog1.Execute then
      begin
         ExcelApplication1.Visible[0]:=True;
        ExcelApplication1.Caption:='Excel Application';
        try
            excelapplication1.Workbooks.Open(opendialog1.FileName,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0);
        except
            ExcelApplication1.Disconnect;//出现异常情况时关闭
            ExcelApplication1.Quit;
            showmessage('请选择EXCEL电子表格!');
            exit;
        end;
      end;
    end;
      

  2.   

    一个参数不对
    还一个try..except的except后不要begin
      

  3.   

    'Not enough actual parameters'的意思是实际参数不够.数一下你的OPEN参数,是十四个吧,实际参数需要十六个。
    procedure TForm1.Button1Click(Sender: TObject);
    begin
    if opendialog1.Execute then
    begin
       aa.Visible[0]:=True;
       aa.Caption:='Excel Application';
        try
          aa.Workbooks.Open(opendialog1.FileName,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0);
        except
        begin
            aa.Disconnect;//出现异常情况时关闭
            aa.Quit;
            showmessage('请选择EXCEL电子表格!');
            exit;
        end;
        end;
    end;
    end;为了调试方便,我把tapplicationexcel的name改为'aa',except后面不写begin就会只在任务失败时只执行紧接except后的那一条语句.
      

  4.   

    修改一下我的错误。try except end结构之间不需要BEGIN END语句,如果有也没有什么问题。就是说可有可无。