procedure TForm1.Button2Click(Sender: TObject);
var
FileName : olevariant;
ExcelApp : TExcelApplication;
CopyBook : _WorkBook;
CopySheet : _WorkSheet;
I,AddCount : Integer;
begin
FileName := 'F:/Programs/Test/word/Book1.xls';
AddCount := 10;
ExcelApp := TExcelApplication.Create(Self);
try
try
ExcelApp.Visible[0] := False;
ExcelApp.Connect ;
ExcelApp.Workbooks.Open(FileName,EmptyParam,EmptyParam,
EmptyParam,EmptyParam,EmptyParam,
EmptyParam,EmptyParam,EmptyParam,
EmptyParam,EmptyParam,EmptyParam,EmptyParam,0);
CopyBook := ExcelApp.Workbooks.Item[1];
CopySheet := ExcelApp.Worksheets.Item[1] as _WorkSheet;//复制第一个Sheet
for I := 1 to AddCountdo
CopySheet.Copy(EmptyParam,CopyBook.ActiveSheet,0);
CopyBook.Save(1);
ExcelApp.Disconnect ;
ExcelApp.Quit;
except
MessageBox(Handle,'无法启动EXCEL程序来转换文件!','提示',MB_OK or MB_ICONINFORMATION);
end;
finally
ExcelApp.Free ;
end;