vf与excel交互

运行环境:vf6.0

clear memory
set safe off
set talk off
ef=CREATEOBJECT('Excel.application')
ef.Workbooks.open("K:/..../结果文件.xls")
ef.visible=.t.
ef.Worksheets("sheet1").Activate
close table
SELECT 1
USE cs.DBF
i=0
GOTO TOP
DO WHILE .not.eof()
select 1
hzsn=alltrim(hzsname)
dsn=alltrim(dsname)
tingname=alltrim(orgname)
tc1cnt=tc1
tc2cnt=tc2
tc3cnt=tc3
tc4cnt=tc4
tc5cnt=tc5
ef.cells(3+i,1).value=hzsn
ef.cells(3+i,2).value=dsn
ef.cells(3+i,3).value=tingname
ef.cells(3+i,4).value=tc1cnt
ef.cells(3+i,5).value=tc2cnt
ef.cells(3+i,6).value=tc3cnt
ef.cells(3+i,7).value=tc4cnt
ef.cells(3+i,8).value=tc5cnt
i=i+1
SKIP
*@ 2,200 say hzsnm
ENDDO

你可能感兴趣的:(Excel)