How to match two doc files using qtp
requirment is:- each and every single word of a doc file
should be matched with the another doc file. can someone
send me the code.



How to match two doc files using qtp requirment is:- each and every single word of a doc file sh..

Answer / kavitapriya cr

Use the script below:
Dim fso,FileName1,FileName2,File1,File2
Set wrdApp=CreateObject("Word.Application")
Set FileName1=wrdApp.Documents.Open("Path\FileName1.doc")
Set FileName2=wrdApp.Documents.Open("Path\FileName2.doc")
Set File1=fso.GetFile(FileName1).OpenAsTextStream(1,0)
Set File2=fso.GetFile(FileName2).OpenAsTextStream(1,0)
CompareFile=True
Do While File1.AtEndOsStream=False
String1=File1.Read(1000)
String2=File2.Read(1000)
If StrComp(String1,String2<>0) Then
CompareFile=False
Exit Do
End If
Loop
If CompareFile=True Then
MsgBox "Files are matching"
else
MsgBox "Files are not matching"
End If
File1.Close
File2.Close
FileName1.Close
FileName2.Close

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More QTP Interview Questions

which is the easiest way you can send the QTP test results to Client if he want to see the screenshots when the results are failed?

1 Answers   CTS,


What are the types of object repositories? Which one is you using?

0 Answers  


How exactly you start scripting in QTP? In the interview he was not satisfied with my answer.Please post what is correct answer.

5 Answers  


Give the syntax to load function at run time.

0 Answers  


suppose i can done the project in automation tool with QTP in that time what i can say?

3 Answers  






How can we use the "CreateObject ("Scripting.FileSystemObject")" in QTP and what is the definition and purpose of it?

2 Answers  


How many function you use in your application?

2 Answers   Polaris,


How can I pass values from one action to another in QTP ?

8 Answers   Ordain Solutions,


What is difference in global and action sheet in qtp?

0 Answers  


For an application we automated QTP scripts. At the same time new requirement comes for a new module for the same application and its already developed. So how we automated now this new module with the old application(using old QTP script).

2 Answers   Bosch,


hi nani my doubt is how does qtp process metrix related to software process.

0 Answers  


how can i sent QTP results to the Html, notefile ,xl file give me the code using g mail login page

0 Answers  


Categories