|
make08 发表于 2015-4-9 13:11
谢谢光之马大师,不过,每改一个文件名,都要点一下“确定”,能否再帮我改进下?
- Public Sub 读取()
- Dim f, ff, fff, fff1, i%, j%
- On Error Resume Next
- i = 1
- Set f = CreateObject("scripting.filesystemobject")
- Set ff = f.getfolder(ThisWorkbook.Path)
- Set fff = ff.subfolders
- For Each fff1 In fff
- Sheet1.Cells(i, 1).Value = fff1.Name
- i = i + 1
- Next
- i = 1
- For i = 1 To Range("a65536").End(xlUp).Row
- j = 0
- Set ff = f.getfolder(ThisWorkbook.Path & "" & Cells(i, 1).Value)
- Set fff = ff.Files
- For Each fff1 In fff
- If j = 0 Then
- fff1.Name = Cells(i, 1).Value & ".jpg"
- Else
- fff1.Name = Cells(i, 1).Value & "(" & j & ").jpg"
- End If
- j = j + 1
- Next
- Next
- End Sub
复制代码 |
|