Excel File Comparing - Error
I'm trying to compare two excel files using below code, I'm getting error and warning...
Sub Cmpare
Cmpare
Set objExcel = CreateObject("Excel.Application")
'Extracting data from the onscreen application
Set iexplore = Sys.Process("iexplore", 2).Page("http://qaserver/Default.asp").document.frames.Frame("mainFrame").document.frames.Frame("ContentFrame").document.frames.Frame("ReportFrameIn4ReportViewer").document.frames.Frame("report").document.all.Item(76)
AgentName = aqObject.GetPropertyValue(iexplore, "innerText")
Log.Message("Agent Name:" &AgentName)
Set iexplore = Sys.Process("iexplore", 2).Page("http://qaserver/Default.asp").document.frames.Frame("mainFrame").document.frames.Frame("ContentFrame").document.frames.Frame("ReportFrameIn4ReportViewer").document.frames.Frame("report").document.all.Item(110)
TotAmt = aqObject.GetPropertyValue(iexplore, "innerText")
Log.Message("Total Amount:" &TotAmt)
Set iexplore = Sys.Process("iexplore", 2).Page("http://qaserver/Default.asp").document.frames.Frame("mainFrame").document.frames.Frame("ContentFrame").document.frames.Frame("ReportFrameIn4ReportViewer").document.frames.Frame("report").document.all.Item(112)
TotBal = aqObject.GetPropertyValue(iexplore, "innerText")
Log.Message("Balance Amount:" &TotBal)
objExcel.Visible = True
objExcel.Workbooks.Add
objExcel.Cells(1, 1).Value = AgentName
objExcel.Cells(1, 2).Value = TotAmt
objExcel.Cells(1, 3).Value = TotBal
objExcel.ActiveWorkbook.SaveAs("E:\ReportData1.xlsx")
objExcel.Quit
Delay 3000
'Compare two excel files to see any changes are there...
If Not Files.Compare("E:\ReportData1.xlsx", "E:\TestData.xlsx") Then
Log.Error("Both the files are NOT same")
Else
log.Message("Both the files are same")
End If
End Sub
Details:
I'm extracting data from the application and saving all the info to the excel file i.e. to E:\ReportData1.xlsx and comparing the same data copying it to E:\TestData.xlsx, I still get the error "Both the files are NOT same" and one warning is shown as below
"The files "E:\ReportData1.xlsx" and "E:\TestData.xlsx" are not equal. HashValue = 319838130.The files "E:\ReportData1.xlsx" and "E:\TestData.xlsx" are not equal. HashValue = 319838130."
Question:
1. How to get rid of above error and warning messages?
2. If I want to use a file which is already stored in my system and I want to extract the data and input the details to that file? (in this case to file "E:\ReportData1.xlsx")
Please do the needful
I'm extracting data from the application and saving all the info to the excel file i.e. to E:\ReportData1.xlsx and comparing the same data copying it to E:\TestData.xlsx, I still get the error "Both the files are NOT same" and one warning is shown as below"The files "E:\ReportData1.xlsx" and "E:\TestData.xlsx" are not equal. HashValue = 319838130.The files "E:\ReportData1.xlsx" and "E:\TestData.xlsx" are not equal. HashValue = 319838130."Question:1. How to get rid of above error and warning messages?2. If I want to use a file which is already stored in my system and I want to extract the data and input the details to that file? (in this case to file "E:\ReportData1.xlsx")Please do the needful