回复 2楼 sdta
谢谢,我要的结果是
,能做到吗?
set safety OFF cDefPath = ADDBS(JUSTPATH(SYS(16))) SET DEFAULT TO (cDefPath) CREATE tabl filenam(fname c(30),rs n(4)) aa=ADIR(mm,'*.xls') FOR nn=1 to aa M_File=juststem(cDefPath+mm(nn,1)) INSERT INTO filenam (fname) VALUES (M_File) ENDFOR REPLACE ALL rs WITH fun() BROWSE USE RETURN FUNCTION fun() xlsx = cDefPath + ALLTRIM(fname) oExcel = CREATEOBJECT('Excel.Application') oExcel.DisplayAlerts = 0 oExcel.WorkBooks.Open(xlsx) oAS = oExcel.ActiveSheet ret = oExcel.CountA(oAS.Range("B:B")) - 1 oExcel.WorkBooks.Close oExcel.Quit RETURN ret ENDFUNC
set safety OFF cDefPath = ADDBS(JUSTPATH(SYS(16))) SET DEFAULT TO (cDefPath) CREATE tabl filenam(fname c(30),rs n(4)) aa=ADIR(mm,'*.xls') FOR nn=1 to aa M_File=juststem(cDefPath+mm(nn,1)) INSERT INTO filenam (fname) VALUES (M_File) ENDFOR REPLACE ALL rs WITH fun() insert into filenam (fname) values ("合计") sele sum(rs) from filenam into array kk replace rs with KK for fname='合计' BROWSE USE RETURN FUNCTION fun() xlsx = cDefPath + ALLTRIM(fname) oExcel = CREATEOBJECT('Excel.Application') oExcel.DisplayAlerts = 0 oExcel.WorkBooks.Open(xlsx) oAS = oExcel.ActiveSheet ret = oExcel.CountA(oAS.Range("B:B")) - 1 oExcel.WorkBooks.Close oExcel.Quit RETURN ret ENDFUNC