>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)Here's my speed tip - just today it took just a few seconds to insert 15300 rows into an Excel sheet. I'm assuming a one-line range is selected, and then I expand it as needed.
_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=cAnd that's it. I may have been off by one here, as I had to rename a few variables to fit the names in the example, and remove some framework related code, but with a couple of tweaks this should work - and it's quite a bit faster than filling cells one by one.
> ENDWITH > .save(lcXLSFile) >ENDWITH > >USE IN foxtest >oExcel.quit() >>