local iRow,iCol
local oExcel,oWorkBook,oSheet
local cFilePath
public cFieldName,cFieldVal
oExcel=createobject("excel.application")
oExcel.visible=.f.
cFilePath=getfile("xls")
IF EMPTY(cFilePath)
messagebox("请选择excel文件")
RETURN
ENDIF
oWorkBook=oExcel.workbooks.open(cFilePath)
oSheet=oWorkBook.sheets(1)
use limz
exclusive
zap
for iRow=1 to oSheet.usedRange.rows.count
append blank
for iCol=1 to
oSheet.usedRange.columns.count
cFieldName=oSheet.cells(1,iCol).value
cFieldVal=oSheet.cells(iRow+1,iCol).value
replace &cFieldName with
cFieldVal
endfor
endfor
" replace &cFieldName with
cFieldVal"运行时候总是出错,数据类型不匹配,帮我改一下?
[
本帖最后由 huangp1991 于 2010-3-18 14:26 编辑 ]