Sub rename() MsgBox "請選擇要重新命名所在的資料夾" With Application.FileDialog(msoFileDialogFolderPicker) .AllowMultiSelect = False .Show reNamePath = .SelectedItems(1) If Right(reNamePath, 1) <> "\" Then reNamePath = reNamePath + "\" End If End With Range("a2").End(xlDown).Select rCount = ActiveCell.Row Dim fs Set fs = CreateObject("Scripting.FileSystemObject") For r = 2 To rCount oName = reNamePath & Cells(r, 1) & ".jpg" If fs.FileExists(oName) Then nName = reNamePath & Cells(r, 2) & ".jpg" Name oName As nName End If Next rEnd Sub需要幫助hi我
Sub rename() MsgBox "請選擇要重新命名所在的資料夾" With Application.FileDialog(msoFileDialogFolderPicker) .AllowMultiSelect = False .Show reNamePath = .SelectedItems(1) If Right(reNamePath, 1) <> "\" Then reNamePath = reNamePath + "\" End If End With Range("a2").End(xlDown).Select rCount = ActiveCell.Row Dim fs Set fs = CreateObject("Scripting.FileSystemObject") For r = 2 To rCount oName = reNamePath & Cells(r, 1) & ".jpg" If fs.FileExists(oName) Then nName = reNamePath & Cells(r, 2) & ".jpg" Name oName As nName End If Next rEnd Sub需要幫助hi我