oExcel = CreateObject("Excel.Application") With oExcel .sheetsInNewWorkbook = 1 .visible = .t. oWorkbook = .workbooks.add() oSheet = oWorkbook.sheets(1) endwith nrow=7 nrecno=1 Select cur_inv with oSheet Go Top SCAN .Cells(nrow,1).Value=cur_inv.invdate .Cells(nrow,2).Value=cur_inv.icsno .Cells(nrow,3).Value=cur_inv.loctid nrow = nrow+1 nrecno = nrecno+1 IF nrecno=60 THEN nrow=7 nrecno=1&& I'm not sure what 'this' section is all about, but you have objects above for the excel application (oExcel) the workbook (oWorkbook) and the sheet (oSheet). From there you should be able to access all you need in Excel.
with This local loWorkbook loWorkbook = .oSheet.Parent .nActiveSheet = .nActiveSheet + 1 if This.nActiveSheet > loWorkbook.Sheets.Count loWorkbook.Sheets.Add(NULL, loWorkbook.Sheets(loWorkbook.Sheets.Count)) .oSheet = loWorkbook.ActiveSheet else .oSheet = loWorkbook.Sheets(This.nActiveSheet) endif .nRow = 1 .nCol = 1 endwith ENDIF SELECT cur_inv ENDSCAN ENDWITH