Forum Discussion
irina_lukina
14 years agoSuper Contributor
Hi Anil,
If you see the folder screenshot, it should pick MyResults.xlsx file, as the modified date of the file is "4/10/2012 3:06PM" all other files are less than today's date.
According to the screenshot, the MyResults.xlsx file was modified on 4/10/2012 at 1:17 PM.
To help us investigate the problem, please run the code below one more time:
Function LastModifiedFile
Dim FolderName, FolderInfo, Num, i, FileDate, a()
FolderName = "E:\Anil-Backup\Test Complete\Projects_Old\In4Suite Project\Exported Reports\"
Set FolderInfo = aqFileSystem.GetFolderInfo(FolderName)
Num = FolderInfo.Files.Count
Log.Message "The folder contains " &Num &" files."
For i = 0 to Num-1
ReDim Preserve a(i)
FileDate = FolderInfo.Files.Item(i).DateLastModified
a(i) = FileDate
Next
NewestTime = a(0)
LatestFileNumber = 1
For i = 0 to Num-1
if(aqDateTime.Compare(NewestTime, FileDate) < 0) then
NewestTime = a(i)
LatestFileNumber = i+1
end if
Next
sPath = FolderInfo.Files.Item(LatestFileNumber -1).Path
Log.Message NewestTime &": " & sPath
End Function
After the test run is over, please export the test results to an .mht file and post it here. Also, please post here the screenshot of the Exported Reports folder right after the test execution has stopped.
Thanks.