kandy1984
12 years agoContributor
Compare .xlsx file
Hi,
i need to compare 2 .xlsx files but the code that i am using (below) is working only for .xls file. May i know what else i need to insert to particulaly compare .xlsx file?
Sub CompareExcelFiles
Dim oExcel, aSheets, vSheet, fileName, aInfo1, aInfo2
Set oExcel = Sys.OleObject("Excel.Application")
Set aSheets = Sys.OleObject("Scripting.Dictionary")
i need to compare 2 .xlsx files but the code that i am using (below) is working only for .xls file. May i know what else i need to insert to particulaly compare .xlsx file?
Sub CompareExcelFiles
Dim oExcel, aSheets, vSheet, fileName, aInfo1, aInfo2
Set oExcel = Sys.OleObject("Excel.Application")
Set aSheets = Sys.OleObject("Scripting.Dictionary")
fileName = "C:\Users\Test\Desktop\sequence_original.xlsx"
Set aInfo1 = ExcelObj.CreateInfo(oExcel, fileName, aSheets)
fileName = "C:\Users\Test\Desktop\sequence.xlsx"
Set aInfo2 = ExcelObj.CreateInfo(oExcel, fileName, aSheets)
oResult = ExcelObj.Compare(aInfo1, aInfo2)
If Len(oResult) > 0 Then
Log.Warning oResult
Else
Log.Message "The files are the same."
End If
oExcel.Quit
End Sub
thanks for helping!