EXCEL 建立工作薄与工作表
1 //1.引用单元 2 uses ComObj; 3 4 //2.建立工作薄与工作表 5 procedure TForm1.Button1Click(Sender: TObject); 6 Var 7 ExcelApp,Sheet:Variant; 8 begin 9 ExcelApp:=createoleobject(\'excel.application\'); 10 ExcelApp.workbooks.add(1); 11 ExcelApp.worksheets.add; 12 ExcelApp.worksheets.add; 13 ExcelApp.worksheets.add; 14 Sheet:=ExcelApp.workbooks[1].worksheets[1]; 15 Sheet.name:=\'200\'; 16 Sheet:=ExcelApp.workbooks[1].worksheets[2]; 17 Sheet.name:=\'400\'; 18 Sheet:=ExcelApp.workbooks[1].worksheets[3]; 19 Sheet.name:=\'600\'; 20 Sheet:=ExcelApp.workbooks[1].worksheets[4]; 21 Sheet.name:=\'800\'; 22 ExcelApp.visible:=true; 23 end;
请发表评论