I have the following code which renames one file name to another however, if I send it down again it doesn't overwrite the original - is it possible to adapt the code so that if resend this information it overwrites the original file?
Thanks
Sub RenameFiles()
Dim iLastRow As Integer
Dim iRow As Integer
Dim sFpath As String
Dim sTpath As String
Dim sFname As String
Dim sTname As String
'paths must include \
' from path
'sFpath = "c:\Temp1\"
'to path
'sTpath = "c:\Renamed\"
'On Error Resume Next
Application.DisplayAlerts = False
iLastRow = Worksheets("sheet4").Cells(Rows.Count, "a").End(xlUp).Row + 1
For iRow = 2 To iLastRow Step 1
sFpath = Cells(iRow, "A").Value
sFname = Cells(iRow, "B").Value
sTpath = Cells(iRow, "C").Value
sTname = Cells(iRow, "D").Value
If Dir(sFpath & sFname) = vbNullString Then
Cells(iRow, "F").Value = "Not Found"
Else
Name sFpath & sFname As sTpath & sTname
Cells(iRow, "F").Value = "Renamed"
End If
Next iRow
Call HighlightChange
Application.DisplayAlerts = True
End Sub
Bookmarks