Hello,
I need to rename a file.
However both filenames are stored in variables.
Name of the original file will change and can be anything. However I need to rename it to a specific file name to run my code.
There will only be 1 file in the folder at a time.
I also need to make a copy of the file and save in Archive folder before renaming it.
Current Code listed below not working. Any suggestions?
Sub DeleteLeft()
Dim OldName As String
Dim NewName As String
Dim GivenLocation As String
OldName = Dir("F:\Corporate\Anshika\Due Dates\left\*.xls")
MsgBox OldName
NewName = "Left.xls"
MsgBox NewName
Name OldName As NewName
End Sub
I need to rename a file.
However both filenames are stored in variables.
Name of the original file will change and can be anything. However I need to rename it to a specific file name to run my code.
There will only be 1 file in the folder at a time.
I also need to make a copy of the file and save in Archive folder before renaming it.
Current Code listed below not working. Any suggestions?
Sub DeleteLeft()
Dim OldName As String
Dim NewName As String
Dim GivenLocation As String
OldName = Dir("F:\Corporate\Anshika\Due Dates\left\*.xls")
MsgBox OldName
NewName = "Left.xls"
MsgBox NewName
Name OldName As NewName
End Sub