|
参与一下。。。
- Sub ykcbf() '//2024.5.28
- Set fso = CreateObject("scripting.filesystemobject")
- Set d = CreateObject("Scripting.Dictionary")
- Application.ScreenUpdating = False
- Set sh = ThisWorkbook.Sheets("basa")
- With sh
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .[a1].Resize(r, 1)
- End With
- For i = 1 To UBound(arr)
- s = arr(i, 1)
- d(s) = i
- Next
- ReDim brr(1 To 1000, 1 To 1)
- p = ThisWorkbook.path & "\测试文件"
- For Each f In fso.GetFolder(p).Files
- If LCase$(f.Name) Like "*.doc*" Then
- fn = f.Name
- If Not d.exists(fn) Then
- m = m + 1
- brr(m, 1) = fn
- End If
- End If
- Next f
- With sh
- If m > 0 Then
- .Cells(r + 1, 1).Resize(m, 1) = brr
- Set Rng = .[a1].Resize(r + m, 3)
- Rng.Sort .[a1], 1
- End If
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|