|
Sub 批量修改文件夹名称01()
On Error Resume Next
' If [a2] = "" Then MsgBox "请点击第一步": Exit Sub
Set obj = CreateObject("Scripting.FileSystemObject") '定义变量
Set fld = obj.getfolder(ThisWorkbook.Path)
For Each ff In fld.SubFolders '遍历文件夹里的所有文件
m = m + 1
Cells(m + 1, 1) = ff.Name '将实际文件名改成目录中C列的对应文件名
Next
MsgBox "改名已完成,请检查", vbOKOnly
End Sub
Sub 批量修改文件夹名称02()
On Error Resume Next
' If [a2] = "" Then MsgBox "请点击第一步": Exit Sub
Set obj = CreateObject("Scripting.FileSystemObject") '定义变量
Set fld = obj.getfolder(ThisWorkbook.Path)
For Each ff In fld.SubFolders '遍历文件夹里的所有文件
m = m + 1
ff.Name = Cells(m + 1, 3) '将实际文件名改成目录中C列的对应文件名
Next
MsgBox "改名已完成,请检查", vbOKOnly
End Sub
|
|