$APPTYPE CONSOLE
$TYPECHECK ON
$INCLUDE "RapidQ.inc"
$INCLUDE "Qxls.inc"
DIM d$ AS STRING
DIM ret AS LONG, ws AS LONG, ns AS LONG, maxrow AS LONG
b=0
d$=COMMAND$(1)
IF d$="" THEN PRINT "Usage: rowtally <DirectoryContainingXlsFiles>: Goto ProgEnd
maxrow=0
FileSpec(b) = DIR$(d$+"\*."xls,0): Goto CheckFile
NextFile:
FileSpec(b) = DIR$
CheckFile:
IF FileSpec(b) = "" THEN Goto TallyDone
FileSpec(b)=d$+"\"+FileSpec(b)
ret = xlsOpen
PRINT STR$(ret)+" Sheet(s) "+FileSpec(b)+" "+sERR
'PrintSheetNames: PrintSSTRecords 'remove comment to see internal data
IF ret < 1 THEN Goto FileClose
ns=ret
FOR ws = 1 to ns: maxrow=maxrow+xlsMAXROW(ws)-xlsMINROW(ws)+1: NEXT ws
FileClose:
ret = xlsClose
Goto NextFile
TallyDone:
PRINT "Total Rows = "+STR$(maxrow)
ProgEnd:
END
|