oRecord.Range("A2:N"+ALLTRIM(STR(nBottom))).Sort( oRecord.Range("A2"), xlAscending, ; oRecord.Range("B1"), ,xlAscending, oRecord.Range("C2"), xlAscending, xlNo, 1, ; .F., xlTopToBottom)As a working sample :
Create cursor testcursor (fld1 i, fld2 i, fld3 i) For ix = 1 to 10000 Insert into testcursor values (int(rand()*5), int(rand()*10), int(rand()*100)) Endfor Wait window nowait "Sending data to Excel..." #include "xlConstants.h" && All xl97 constants lcTempExcelFile=sys(5)+curdir()+"X"+sys(2015)+".xls" Copy to (lcTempExcelFile) type xl5 && Copied to xls file =sys(3006,1033) oExcel = createobject("Excel.application") With oExcel .workbooks.open(lcTempExcelFile) && Open saved xls With .Activeworkbook.Activesheet .Application.Selection.Sort( ; .Range("A2"), xlAscending, .Range("C2"), , xlDescending, ; .Range("B2"), xlAscending, xlYes, 1, .f., xlTopToBottom ) Endwith wait clear .visible = .t. && Done - show Endwith lnHandle = fopen(lcTempExcelFile,12) Do while lnHandle<0 lnHandle = fopen(lcTempExcelFile,12) Enddo =fclose(lnHandle) Erase (lcTempExcelFile)Cetin