Parameters pexcelfile
Local oExcel,_lineno,i,length1,nOldRecno
#Define ESC 27
If file(pexcelfile)
nOldRecno=recno()
oExcel=createobject("Excel.Application")
oExcel.workbooks.open(pexcelfile,.F.,.F.)
_lineno=recno()+1
=afield(fa)
If between(nOldRecno,1,reccount())
Go (nOldRecno)
Endif
length1=alen(fa,1)
Set cursor off
Do while not eof()
For i=1 to length1
oExcel.Cells(_lineno,i).value=eval(fa[i,1])
Endfor
_lineno=_lineno+1
Skip
If inkey()=ESC
Exit
Endif
Wait window "正在處理記錄"+trans(recno())+"..." nowait
Enddo
Set cursor on
Wait clear
oExcel.ActiveWorkbook.Save
oExcel.ActiveWorkbook.Saved = .T.
oExcel.ActiveWorkbook.Close
oExcel.quit
Endif
*這是一個自定義方法,功能是將當前工作區中表的記錄增加到excel文件中