下面这样,逻辑上有点取巧,把最初的工作表另存了一下,少新建了一个工作表procedure SplitExcel(FileName:string);var wk,ExcelApp:variant; i:integer; str:string;begin if fileexists(FileName) then begin ExcelApp:=CreateOleObject('Excel.Application'); try wk:=ExcelApp.workbooks.open(FileName); for i:=wk.WorkSheets.count downto 2 do begin wk.WorkSheets.move; end; for i:=ExcelApp.Workbooks.count downto 1 do begin str:=extractfilepath(FileName)+ExcelApp.workbooks.worksheets[1].name; ExcelApp.workbooks.saveas(str); ExcelApp.WorkBooks.Close; end; finally ExcelApp.Quit; ExcelApp:=Unassigned; end; end;end;如果逻辑上看着乱,用下面这样写procedure SplitExcel(FileName:string);var wk,ExcelApp:variant; i:integer; str:string;begin if fileexists(FileName) then begin ExcelApp:=CreateOleObject('Excel.Application'); try wk:=ExcelApp.workbooks.open(FileName); wk.worksheets.add; {先创建个新的,保证所有原始工作表都能被独立建出去} for i:=wk.WorkSheets.count-1 downto 1 do begin wk.WorkSheets.move; end; wk.saved:=true; {把原始工作表取消保存} wk.close; for i:=ExcelApp.Workbooks.count downto 1 do begin str:=extractfilepath(FileName)+ExcelApp.workbooks.worksheets[1].name; ExcelApp.workbooks.saveas(str); ExcelApp.WorkBooks.Close; end; finally ExcelApp.Quit; ExcelApp:=Unassigned; end; end;end;