user
OleServer,Excel2000,ComObj;
Excel: Variant;
WBk, WS, SheetName,RG: OleVariant;
try
Excel := GetActiveOleObject('Excel.Application');
except
MessageBox(form1.WindowHandle,'请先打开Excel的XLS文件.',myts,MB_OK+MB_ICONINFORMATION);
//Excel := CreateOleObject('Excel.Application');
exit;
end;
wbk:=Excel.ActiveWorkbook;
Excel.Application.Visible:= true;
WS:=Excel.Worksheets[1]
RG:=ws.Range['A1:A10'];
RG.UsedRange.Copy;
end;
//粘貼到Word
Var Wordrange:variant;
begin
Wordrange:=WordDocument1.Range;
WordRange.PasTE;
end;