pedenspeed
New Member
- Joined
- Jul 13, 2021
- Messages
- 2
- Office Version
- 365
- Platform
- Windows
Hello all,
I have seen the code posted to rename a file but for some reason no matter what I do, I get a run-time error '53': File not found. I have tried several ways, but this is what I currently have:
Sub removedate()
Dim oldFileName As String
Dim newFileName As String
oldFileName = Dir("C:\Users\k1rbr0\Desktop\afsm100 at risk\Avenger\Outputs\AFSM100Benchmark*.*")
newFileName = "C:\Users\k1rbr0\Desktop\afsm100 at risk\Avenger\Outputs\Data\AFSM100Benchmark.xlsx"
Name oldFileName As newFileName
End Sub
Any ideas on why its not working? I have tried without the Dir and with Dir and when Debugging, it shows me that oldFileName has the correct file string, and newFileName has the correct string (full path).
Is there another way to rename the file, or even create the new workbook without the date keeping the original?
Any help is appreciated!!
I have seen the code posted to rename a file but for some reason no matter what I do, I get a run-time error '53': File not found. I have tried several ways, but this is what I currently have:
Sub removedate()
Dim oldFileName As String
Dim newFileName As String
oldFileName = Dir("C:\Users\k1rbr0\Desktop\afsm100 at risk\Avenger\Outputs\AFSM100Benchmark*.*")
newFileName = "C:\Users\k1rbr0\Desktop\afsm100 at risk\Avenger\Outputs\Data\AFSM100Benchmark.xlsx"
Name oldFileName As newFileName
End Sub
Any ideas on why its not working? I have tried without the Dir and with Dir and when Debugging, it shows me that oldFileName has the correct file string, and newFileName has the correct string (full path).
Is there another way to rename the file, or even create the new workbook without the date keeping the original?
Any help is appreciated!!