請教
在office2010 跑某支巨集, 產出的結果正確,但是升級到office2021, 卻產出重覆資料的情況,是否有建議的排除方式呢? 謝謝
tpath="c:\test"
tfile=dir(spath &"\".xlsx")
Workbooks.add
Cells(1,1)="field1"
Cells(1,2)="field2"
ActiveWorkbooks.SaveAs "c:\test\total.xlsx"
set wks=workbooks("total.xlsx").sheets(1)
do while tfile <>""
workbooks.open tpath &"\"& tfile
set wkso = workbooks(tfile).sheets(1)
cont1=wks.range("B" &Excel.rows.count).End(xlUp).Row
cont = wkso.range("B" & excel.rows.count).End(xlup).Row
for lop =1 to cont-1
wks.cells(cont1 + lop,1) = wkso.cells(1+lop,1)
windows("total.xlsx").activate
columns("L:L").select
selection.numberformatlocal="yyyy/m/d"
columns("F:F").select
selection.numberformatlocal="yyyy/m/d"
next
workbooks(sfile).close
sfile = dir()
loop