Compare Excel files - Object required: 'ExcelObj' (Run time error)
I've installed ExcelSheetCompare script extension and using the below mentioned code snippet taken from https://support.smartbear.com/viewarticle/9046/
Sub Main
Dim oExcel, aSheets, vSheet, fileName, aInfo1, aInfo2
Set oExcel = Sys.OleObject("Excel.Application")
Set aSheets = Sys.OleObject("Scripting.Dictionary")
'You can specify the sheet to be compared
vSheet = "Data"
Call aSheets.Add(vSheet, vSheet)
fileName = Project.Path + "\Data1.XLSX"
Set aInfo1 = ExcelObj.CreateInfo(oExcel, fileName, aSheets)
vSheet = "Data"
Call aSheets.Add(vSheet, vSheet)
fileName = Project.Path + "\Data2.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
I get the following error everytime I run my code: -
Object required: 'ExcelObj'
Error location:
Unit: "MAP Framework\Framework\Script\Excel"
Line: 105 Column: 3.