chiplarsen
IS-IT--Management
I am trying to do something that I am sure is simple, but I have not work with VBScript much at all. I want to open a text file in one directory and save as to another directory with a new name. When I run this code from a cmd prompt, I do not get an error, it just executes and does nothing in reference to the code. Can someone point me in the right direction? Thank you for your help.
Code:
On Error Resume Next
strMonth=Month(DateAdd("d",-1,Date))
If Trim(Len(strMonth))<2 Then strMonth="0"&strMonth End If
strDay=Day(DateAdd("d",-1,Date))
If Trim(Len(strDay))<2 Then strDay="0"&strDay End If
strFileNameExt=Year(DateAdd("d",-1,Date))&strMonth&strDay
'***** Open Text File *****
Const ForWriting = 2
Set objFSO = OpenObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile ("C:\PERSELOG\PERSE.TXT")
'*****
'***** Save/close TXT File *****
objTextFile.SaveAs("C:\PERSELOG\PERSEBK\PERSE-"&strFileNameExt&".TXT")
Set objTextFile=Close
'*****