|
求助:有一段‘移动工作表’的宏,用数字命名了的子文件夹(见附件)怎么不支持?不能移动工作表。帮修改。比如,子文件夹名 20180910-0922
Sub 移动文件夹()
Dim fso, fth, pth, Arr, j, i
Set fso = CreateObject("Scripting.FileSystemObject")
fth = ThisWorkbook.Path & "\*客户搜索词*.xlsx"
Arr = [a1].CurrentRegion
Application.ScreenUpdating = False
For j = 2 To UBound(Arr)
If Len(Arr(j, 1)) > 0 Then
pth = ThisWorkbook.Path & "\" & Arr(j, 1)
For i = 2 To UBound(Arr)
If Len(Arr(i, 2)) > 0 Then
pth = ThisWorkbook.Path & "\" & Arr(j, 1) & "\" & Arr(i, 2) & "\"
If Not fso.folderexists(pth) Then
MkDir pth
End If
fso.copyfile fth, pth, True
End If
Next i
End If
Next j
Application.ScreenUpdating = True
End Sub |
|