Forum Discussion
irina_lukina
13 years agoSuper Contributor
Try running the code below:
Function checkexcelcells()
Dim ExlValue
ExlValue = LastModifiedFile
' Open Excel Connection
Set Excel = Sys.OleObject("Excel.Application")
Call Excel.Workbooks.Open("E:\Anil-Backup\Test Complete\Projects_Old\In4Suite Project\Exported Reports\" & ExlValue)
Delay 5000
End Function
'===============================================================================
Function LastModifiedFile
Dim FolderName, FolderInfo, Num, i, FileDate, NewestTime, LatestFileIndex
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."
NewestTime = aqDateTime.SetDateTimeElements(1000, 1, 1, 0, 0, 0)
LatestFileIndex = 0
For i = 0 to Num-1
FileDate = FolderInfo.Files.Item(i).DateLastModified
if(aqDateTime.Compare(NewestTime, FileDate) < 0) then
NewestTime = FileDate
LatestFileIndex = i
end if
Next
sPath = FolderInfo.Files.Item(LatestFileIndex).Path
fName = FolderInfo.Files.Item(LatestFileIndex).Name
Log.Message NewestTime &": " & sPath
Log.Message NewestTime &": " & fName
LastModifiedFile = fName
End Function
Does it work now?
Related Content
- 2 years ago
Recent Discussions
- 3 days ago
- 4 days ago