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

What is .Ini file in QTP?

3 Answers  


what are all the fileds present in object repository?

0 Answers   Wipro,


What is the significance of “action 0” in qtp?

0 Answers  


How to differentiate the webedit field like user name and password? Please tell any other best answer is ther

3 Answers   Navis,


I m trying to automate one vb desktop application in that there is vblist vbcombobox many other vb tools are there ,when i m trying to find some unique property to identify the object (take example of vbcombobox ) I cannot find any unique property, all the combobox belong to same nativeclass same name no ids are available ,only the distinct property is there x and y coordinates so i m using some code like this "vbbutton "nativeclass:=ThunderRT6CommandButton","x:=304","y :=443").exist(2)" but i dont find them reliable .Can anyone suggest me some other way to identify those objects with some unique property or is there any way to register our own property .I m using descriptive programming to write the code .Thanks in advance

6 Answers   Cimcon,






What type of error u will get if u have not installed java add in in java project? what is the error name ?

1 Answers   Verizon,


How to create an Action Template?

1 Answers  


I want to open a Notepad window without recording a test and I do not want to use SystemUtil.Run command as well How do I do this?

12 Answers  


Hi All, I need 5 yrs exp manual and automation testing using QTP sample resume. is there any body having please send me my mail id is bjr@aol.in Tahnks in Advance

0 Answers  


what is smart identification?

1 Answers  


In this bellow script QTP is not able to getting no. of Links from my Browser. Set desc=description.create desc("micclass").value="Link" Set obj=Browser("creationtime:=0").page("title:=.*").childobjects(desc) msgbox obj.count I am getting "General Run Error".Why QTP is not supporting my Browser,but its running fine in other system.Please help me to overcome this problem.

1 Answers  


how to count spaces in a given string ex: "this is jagadeesh" in QTP with simple functional script

5 Answers   Cap Gemini,


Categories