遇到点小问题,请大家帮助纠错

来源:互联网 发布:三国杀菜刀的淘宝 编辑:程序博客网 时间:2024/05/29 17:12
上一个帖子在大家的指点下,我总算做了个我所需要的程序。
我试了N次,可以运行并且达到我要的效果。
请哪位大哥帮个忙,解决我以下几个问题:
1.使用zap命令,会有提示窗口,怎么才能不跳出窗口,默认选择“是”
2. for i=2 to nrows, 在这个循环之前,我想做判断行数<=1时,用messagebox(),并且退出循环。 我尝试了N次,都提示嵌套错误。
3.如有发现其他不妥的地方,还请大家直接纠正,谢谢。


if used('dylx') then
select dylx
else
select 0
use dylx
endif
zap
set defa to ('d:\data')
for m = 1 to adir(afiles,'*.xlsx') 
    findfiles='d:\data\'+afiles[m,1]
    ? findfiles
    myexcel=CREATEOBJECT("excel.application")
    myexcel.visible=.f.
    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
       myexcel.quit
endfor
0 0
原创粉丝点击