Forum Discussion

maia's avatar
maia
New Contributor
14 years ago

Problems with function Compare

Hello, i am having a problem with my code:




Sub Main

  Dim oExcel,oExcel2, aSheets, vSheet, fileName, aInfo1, aInfo2 

  Set oExcel = Sys.OleObject("Excel.Application")

  Set oExcel2 = Sys.OleObject("Excel.Application")

  Set aSheets = Sys.OleObject("Scripting.Dictionary")

  

  'You can specify the sheet to be compared 

  'vSheet = "Sheet1"

  'Call aSheets.Add(vSheet, vSheet) 

  

  fileName = "c:\massa_teste.xls"

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

   

  fileName2 = "c:\resultado.xls"

  Set aInfo2 = ExcelObj.CreateInfo(oExcel, fileName2, aSheets)

  





  

  

  set oResult = oExcel.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


The object does not support this property or method: 'o.Excel.Compare'.

1 Reply

  • ASV's avatar
    ASV
    Contributor
    Hi Filipe



    "Compare" is not oExcel's function. It is ExcelObj's function.

    write in this way 

    ExcelObj.Compare(aInfo1, aInfo2)