Delphi

zhaozj2021-02-17  47

// Excel cell copy and paste procedure Excel_copyCells; var sheet, XLApp, workbook, myRange1, myRange2: variant; begin try // Create Object XLApp: = createOleObject ( 'Excel.Application'); XLApp.displayAlerts: = true; XLApp .Screenupdating: = true; xlapp.visible: = true; xlapp.workbooks.add ('d: /test.xls'); workbook: = xlapp.workbooks [1]; Sheet: = Workbook.worksheets [1]; myrange1 : = Sheet.Range [Sheet.cells [39, 1], Sheet.cells [79, 16]]]; MyRange2: = Sheet.Range [Sheet.cells [80, 1], Sheet.cells [120, 16]]]]]]]]]]]]]]] MyRANGE1.Copy; Finally if not varisempty (xlapp) The begin xlapp.displayalerts: = false; xlapp.screenupdating: = true; xlapp.quit; end; end; end;

转载请注明原文地址:https://www.9cbs.com/read-28943.html

New Post(0)