VFP读入EXCEL数据怪问题,求助!!!
程序代码:
SET talk off SET SAFETY off SELECT 1 USE tab3 zap myexcel=createobject('excel.application') &&创建一个对象 myexcel.visible=.t.&&不可见 FOR i=1 TO adir(m_file1,"*.xls*") strFname = Addbs(SYS(5)+SYS(2003)) + m_file1(i,1) bookexcel=myexcel.workbooks.open(strfname) NEXT RETURN
这段程序可以相应文件夹下所有的EXCEL文件,但是我在循环里加入一些把数据写入到相应DBF文件的语句后,读完一个EXCEL文件写入数据后就不再打开其他的EXCEL文件了,各位大侠们帮我看看
程序代码:
SELECT 1 USE tab3 zap myexcel=createobject('excel.application') &&创建一个对象 myexcel.visible=.t.&&不可见 FOR i=1 TO adir(m_file1,"*.xls*") strFname = Addbs(SYS(5)+SYS(2003)) + m_file1(i,1) bookexcel=myexcel.workbooks.open(strfname) SELECT 1 APPEND BLANK REPLACE bh WITH i,mc WITH bookexcel.worksheets("PUB").cells(6,3).value sj1=bookexcel.worksheets("表三甲").usedrange.value FOR i=7 TO ALEN(sj1,1)-3 IF TYPE("SJ1(I,5)")<>"N" EXIT ELSE IF sj1(i,5)>0 APPEND BLANK REPLACE bh WITH sj1(i,1),debh WITH sj1(i,2),mc WITH sj1(i,3),dw WITH sj1(i,4) REPLACE sl WITH sj1(i,5),jggr WITH sj1(i,6),pggr WITH sj1(i,7),zjggr WITH sj1(i,8) REPLACE zpggr WITH sj1(i,9),grxs WITH sj1(i,10) ENDIF ENDIF NEXT NEXT RETURN
附件.rar
(229.18 KB)
[此贴子已经被作者于2017-4-18 18:28编辑过]