先加入ExcelApplication1;ExcelWorkbook1;ExcelWorksheet1;
procedure TForm1.n1Click(Sender: TObject);
var
  row,brea:integer;
  a,b,c,d,e:shortstring;
begin
  if table1.active = True then begin
    try
      ExcelApplication1.Connect;
    Except
      ExcelApplication1.free;
      Abort;
    end;
    brea := strtoint(inputbox('输入需导入行数!','行数','10'));
    if brea<1 then brea := 10;
    ProgressBar1.Visible := True;
    ProgressBar1.Max := brea;
    ExcelApplication1.Visible[0] := true;
    for row := 2 to brea do
    begin
      a := ExcelWorksheet1.Cells.Item[row,2];
      b := ExcelWorksheet1.Cells.Item[row,1];
      c := ExcelWorksheet1.Cells.Item[row,3];
      d := ExcelWorksheet1.Cells.Item[row,4];
      e := ExcelWorksheet1.Cells.Item[row,5];
      form1.show;
      table1.AppendRecord([a,b,c,d,e]);
      ProgressBar1.Position := row-1;
    end;
    ProgressBar1.Hide;
  end;
end;