Rename a excel file via VB script
Posted on 2014-01-05
I have a question on VB script
I want to rename a excel file but the problem is that every day the source excel name is changed where as Destination excel name need to be constant
I used below code:
Set Fso = WScript.CreateObject("Scripting.FileSystemObject")
Fso MoveFile "D:\test\Databank\ResultsFile_5_Jan.xls", "D:\destination\Result2\Result.xls"
but on another day ResultsFile_5_Jan.xls changed to ResultsFile_6_Jan.xls and so on
I tried with regular expressions and it is not working like:
Fso MoveFile "D:\test\Databank\ResultsFile*.xls", "D:\destination\Result2\Result.xls"