考虑到excel 表格文件数目多少不确定,还不能把filenam里fname字段内容固定。
程序代码:
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