Why not just rename the file?
save the file in a folder
Put the path in the macro
Click on the button
Sub Test()
Dim fso, fsoFolder, fsoFile, strPath, strName
Set fso = CreateObject("Scripting.FileSystemObject")
'*********Modify Next Line *************************************
Set fsoFolder0 = fso.GetFolder("C:\Users\Mehmetcik\Desktop\New folder")
count = 0
For Each fsoFile In fsoFolder0.Files
strName = fsoFile.Name
If Not IsNumeric(Mid(strName, 21, 9)) Or Left(strName, 9) <> "File name" Then GoTo 20
Range("A1").Value = Mid(strName, 21, 9) + 5
NewName = "File name" & Year(Now) & "-" & Month(Now) & "-" & Day(Now) & "-" & Format(Mid(strName, 21, 9) * 1 + 5, "000000000") & ".xlsx"
Range("A1").Value = NewName
strPath = Left(fsoFile.Path, Len(fsoFile.Path) - Len(strName))
fso.CopyFile strPath & strName, strPath & NewName
fso.DeleteFile strPath & strName
Exit For
20 Next
End Sub
Bookmarks