>>SET SAFETY OFF >>CREATE TABLE foxtest (ca c(10), cb c(10), cc c(10)) >>PRIVATE icounter >>FOR icounter = 1 TO 1000 >> sele foxtest >> APPEND BLANK >> REPLACE ca WITH "a" + ALLTRIM(STR(icounter)) >> REPLACE cb WITH "b" + ALLTRIM(STR(icounter)) >> REPLACE cc WITH "c" + alltrim(STR(icounter)) >> icounter = icounter + 1 >>ENDFOR >> >>RELEASE oExcel >>lcXLSFile = 'foxtest' >>lcXLSFile = ForceExt(lcXLSFile, "XLS") >> >>lcRange = "a1:c1000" >>oExcel = CREATEOBJECT("excel.application") >>WITH oExcel >> .WorkBooks.add() >> WITH .ActiveWorkbook.ActiveSheet.RANGE(lcRange)>
_vfp.DataToClip(,,3) > * remove first line from clipboard, contains column names > c=_cliptext > _cliptext=Strtran(_cliptext, Mline(_cliptext,1)+chr(13),"") > > If RECCOUNT() > 1 > oExcel.Application.CutCopyMode = .t. > oRng = oExcel.Range(oExcel.Cells(.Row + 1, 1), oExcel.Cells(.Row + reccount() - 1, 1)) > oRng.EntireRow.Insert > ENDIF > oRng.select() > oExcel.selection.PasteSpecial() > _cliptext=c >>
> ENDWITH >> .save(lcXLSFile) >>ENDWITH >> >>USE IN foxtest >>oExcel.quit() >>>>