ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories >> Software >> Testing >> Automation-Testing >> QTP
 
 
 
Question
I want to open a text file and then search some specified 
text in it and then replace that text with some other text 
i found that text in .txt but do not know how to replace 
that text can any body help me. if possible put the code 
for qtp
 Question Submitted By :: Ankur_jain
I also faced this Question!!     Rank Answer Posted By  
 
Answer
Const ForReading = 1, ForWriting = 2
  Dim fso, f
  Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.OpenTextFile("c:\working\replace.txt", 
ForWriting, True)
   f.Write "QTP QTP RFT QTP QTP RFT QTP QTP"
   Set f = fso.OpenTextFile("c:\working\replace.txt", 
ForReading)
   ReadAllTextFile =   f.ReadAll
   newText = Replace( ReadAllTextFile, "QTP", "QTPRO") 
  Set textFile = fso.OpenTextFile
( "C:\working\replace.txt", ForWriting )
  textFile.WriteLine newText
  f.Close
 
2
Rico
 
View All Answers
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com