below code performs a batch renaming of files by using cell values in Column A and Column B of the active worksheet (Column A values = old name; Column B values = new file name)
I would like to have a 'folder picker' incorporated in that code but I got no idea how this is coded.
I would appreciate it very much if somebody could help me with this.
Thank you very much in advance.
Public Sub RenameFiles()
Dim fso As Scripting.FileSystemObject
Dim vFiles As Variant
Dim i As Long
Dim oFile As Scripting.File
Dim sFilePath As String
Const cFILE_PATH As String = "C:\Temp"
Set fso = New Scripting.FileSystemObject
vFiles = ActiveSheet.Cells(1).CurrentRegion.Value
For i = 1 To UBound(vFiles, 1)
sFilePath = .BuildPath(cFILE_PATH, vFiles(i, 1))
If .FileExists(sFilePath) Then
Set oFile = .GetFile(sFilePath)
oFile.Name = vFiles(i, 2)