WorkPath=GETDIR("","","请选择文件夹:")
IF !EMPTY(WorkPath)
IF FILE(WorkPath+"结果表.XLSX")
nFiles=Adir(MyArray,WorkPath+'*.xlsx')
IF nFiles>1
FOR i=1 TO 2 nFiles
cWaitmesg="正在处理数据 ,请稍候...... "+ALLTRIM(STR(I))+"/"+ALLTRIM(STR(nFiles))
Wait Window cWaitmesg Nowait At srow()/2,(scol()-len(cWaitmesg))/2
xlsfile=MyArray(i,1)
IF !"结果表"$xlsfile
eole=CREATEOBJECT("Excel.application")
eole.Workbooks.Open(WorkPath+xlsfile)
nRow=VAL(CHRTRAN(SUBSTR(eole.cells(1,1).value,ATC('第',eole.cells(1,1).value)+2,ATC('行',eole.cells(1,1).value)-ATC('第',eole.cells(1,1).value)-2),Chr(161),""))
IF nRow>0
eole.ActiveSheet.Range("A"+ALLTRIM(STR(nRow-10))+":H"+ALLTRIM(STR(nRow+10))).Copy &&拷贝指定区域
eole.Workbooks.Open(WorkPath+"结果表.XLSX")
nRowCounts=eole.SHEETS(1).UsedRange.Rows.Count &&已有行数
eole.ActiveSheet.Range("B"+ALLTRIM(STR(nRowCounts+1))).PasteSpecial &&粘贴
FOR j=nRowCounts+1 TO eole.SHEETS(1).UsedRange.Rows.Count
eole.Cells(j,1).value=JustStem(xlsfile)
ENDFOR
eole.ActiveWorkbook.Save()
ENDIF
eole.Workbooks.Close
eole.quit
ENDIF
ENDFOR
WAIT CLEAR
MESSAGEBOX("共处理 "+ALLTRIM(STR(nFiles-1))+" 个文件!",0+48+0,"提示:")
ENDIF
ENDIF
ENDIF
是这意思吗?
[此贴子已经被作者于2022-11-3 16:24编辑过]