|
- Sub lqxs()
- Dim fp$, fn, i&, aa, nm$, nm1$
- Set d = CreateObject("Scripting.Dictionary")
- With Application.FileDialog(msoFileDialogFolderPicker)
- .Title = "请选择目标文件夹"
- .Show
- If .SelectedItems.Count = 0 Then MsgBox "没有选择文件夹,程序退出!", 64, "提示": Exit Sub
- fp = .SelectedItems(1)
- End With
- aa = InStrRev(fp, "")
- nm = Right(fp, Len(fp) - aa)
- fn = Dir(fp & "\*.png")
- Do While fn <> ""
- i = i + 1
- If i = 1 Then
- nm1 = nm & ".png"
- Else
- nm1 = nm & "(" & i - 1 & ").png"
- End If
- Name fp & "" & fn As fp & "" & nm1
- fn = Dir
- Loop
- End Sub
复制代码 |
|