|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub limonet()
Dim Dic As Object, i%, S$, Path$
Set Dic = CreateObject("scripting.dictionary")
For i = 3 To Range("A" & Rows.Count).End(xlUp).Row
Dic(Cells(i, "D").Value) = Dic(Cells(i, "D").Value) & "," & Cells(i, "A").Value & ".txt"
Next i
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.CurrentDirectory = ThisWorkbook.Path
WSHShell.Run "Powershell foreach ($S in ('" & Join(Dic.keys(), "','") & "')) { MD $S}", 0, True
For i = 0 To Dic.Count - 1
WSHShell.Run "Powershell Move-item " & Mid(Dic.items()(i), 2) & " .\" & Dic.keys()(i), 0, True
Next i
End Sub
|
|