New to Active X and Visual Basic, trying to get a grip on the coding. Below is what I have come up with to rename a .csv file to have the date appended to the end of it. The scipt says sucessful after running but the file name isn't changing, what I am missing. Thanks in advance for any replies!



Function Main()

Dim FDate
Dim DString
Dim objFSO
Dim File_XYT

FDate = Date
DString = DatePart("yyyy",FDate) & Right("0" & _
DatePart("m",FDate), 2) & Right("0" & DatePart("d",FDate), 2)

Set objFSO = CreateObject("Scripting.FileSystemObject")
File_538 = "\\PayrollFiles\ADPData\FTM (XYT)\PRXYTEMP"
If objFSO.FileExists(File_XYT) Then
File_XYT.Name = "PRXYTEMP" & DString & ".csv"
else
Main = DTSTaskExecResult_Failure
End If

Main = DTSTaskExecResult_Success
End Function