优化了一下:
set defa to ('d:\data')
SET SAFETY OFF
IF used('dylx')
select dylx
ELSE
use dylx IN 0
ENDIF
zap
myexcel=CREATEOBJECT("excel.application")
myexcel.visible=.f.
FOR
m = 1 to adir(afiles,'*.xlsx')
findfiles='D:\data\'+afiles[m,1]
? findfiles
mybook=myexcel.workbooks.open("&findfiles")
usedrange=mybook.worksheets(1).usedrange
nrows=usedrange.rows.count
FOR i=2 to nrows
m1=myexcel.cells(i,1).value
m2=myexcel.cells(i,2).value
m3=myexcel.cells(i,3).value
m4=myexcel.cells(i,4).value
m5=myexcel.cells(i,5).value
APPEND BLANK
REPLACE DATE WITH m1,SELLER WITH m2,BUYER WITH m3,quantity WITH m4,PRODUCT WITH m5
ENDFOR
myexcel.workbooks.close
ENDFOR
myexcel.quit
set defa to ('d:\vfp')