how to compare two excell sheets by using vbscript??

Answers were Sorted based on User's Feedback



how to compare two excell sheets by using vbscript??..

Answer / maruthi ram

Set objExcel = CreateObject("Excel.application")
objExcel.Visible = True
Set objWorkbook1 = objExcel.workbooks.open("D:\maruthi1.xls")
Set objWorkbook2 = objExcel.workbooks.open("D:\maruthi2.xls")
Set objWorksheet1 = objWorkbook1.worksheets(1)
Set objWorksheet2 = objWorkbook2.worksheets(1)
For Each cell In objWorksheet1.UsedRange
If cell.Value <> objWorksheet2.Range(cell.Address).Value Then
msgbox "value is different"
Else
msgbox "value is same"
End If
Next
objWorkbook1.close
objWorkbook2.close
objExcel.quit
set objExcel=nothing

Is This Answer Correct ?    6 Yes 0 No

how to compare two excell sheets by using vbscript??..

Answer / deven

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook1= objExcel.Workbooks.Open("E:\Deven1.xls")
Set objWorkbook2= objExcel.Workbooks.Open("E:\Deven2.xls")
Set objWorksheet1= objWorkbook1.Worksheets(1)
Set objWorksheet2= objWorkbook2.Worksheets(1)
For Each cell In objWorksheet1.UsedRange
If cell.Value <> objWorksheet2.Range(cell.Address).Value
Then
msgbox "value is different"
Else
msgbox "value is same"
End If
Next
objWorkbook1.close
objWorkbook2.close
objExcel.quit
set objExcel=nothing

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More QTP Interview Questions

What are the data types in qtp?

0 Answers  


How to start recording using quicktest professional (qtp)?

0 Answers  


What are the differences between table and db checkpoints?

0 Answers  


1)what is the Exact Meaning of Environment Variables? 2)what is Compile Module in QTP? what exactly it contains Functions or Actions?

4 Answers  


What is checkpoints for quicktest professional (qtp)?

0 Answers  


what is syncurnisation point? what is the use of this in real time environment? plz explain?

6 Answers   AppLabs,


If I change the property value at runtime is it effect is object repository?

0 Answers  


can i compare two databases using QTP ?

0 Answers  


pls tell me different type of automation frame works in QTP and which one need to select in client server application

7 Answers   Syntel,


How QTP support all types of applications (platforms)?

0 Answers  


how can we preform retesting(DATA driven test) using function please gine the code for loginpage

0 Answers   W3 Solutions,


how do u retrieve data from a database ? i.e. i want to retrieve 2nd record only from a database ? write code for this. by using ADODB connecton, RSOBJ and using a FOR loop we can retrieve all the records( ex: if we give query as select * from emp). but i want only 2nd record. so how to acheive this.

2 Answers   Accenture,


Categories