Hi Sudha,
Is Ms-Office 2007 or higher is installed in your system because .xlsx is supported in MsOffice 2007 and higher.
For this campare, better use the ExcelDrivers (I don't know your exact requirement in excel comparision). try below sample code.
Sub ComapreExcels(strExcel1, strSheet1, strExcel2, strSheet2)
Dim objExcel1, objExcel2, intRowCount1, intRowCount2, strErrorDescription, blnValidationStatus
intRowCount1 = 0
intRowCount2 = 0
Set objExcel1 = DDT.ExcelDriver(strExcel1, strSheet1, True)
Set objExcel2 = DDT.ExcelDriver(strExcel2, strSheet2, True)
If objExcel1.ColumnCount <> objExcel2.ColumnCount Then
LogReport "Fail"
Exit Sub
End If
While Not objExcel1.EOF
intRowCount1 = intRowCount1 + 1
objExcel1.Next
Wend
While Not objExcel2.EOF
intRowCount2 = intRowCount2 + 1
objExcel2.Next
Wend
If intRowCount1 <> intRowCount2 Then
LogReport "Fail"
Exit Sub
End If
objExcel1.First
objExcel2.First
While Not objExcel1.EOF
For intColumnCounter = 0 To objExcel1.ColumnCount - 1
If objExcel1.Value(intColumnCounter) = objExcel2.Value(intColumnCounter) Then
LogReport "Fail"
End If
Next
objExcel1.Next
objExcel2.Next
Wend
DDT.CloseDriver(objExcel1.Name)
DDT.CloseDriver(objExcel2.Name)
End Sub