Forum Discussion

kandy1984's avatar
kandy1984
Contributor
12 years ago

Comparing excel files doesnt work

Hi,

im using TestComplete 9.10.1894.7 version. my task is to compare 2 excel files. sequence.csv and sequence_original.csv. i got the codes from http://support.smartbear.com/viewarticle/9046/?_ga=1.210986961.570336933.1385603847 website. i have installed the extension as well. but when i run the code, its just hangs. the code is below. may i know when am i going wrong?


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.csv"

  Set aInfo1 = ExcelObj.CreateInfo(oExcel, fileName, aSheets)

  

  fileName = "C:\Users\Test\Desktop\sequence.csv"

  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



it seems to open up excel file and then waits for something in line "  Set aInfo1 = ExcelObj.CreateInfo(oExcel, fileName, aSheets)"



Thank for helping.