How to search a particular string and write/add some new text in that position in a word file?

Suppose, I have two word files, and from 1st file, I need to take a string and search in 2nd word file and where it will found the searched string, just add some new text with the previous data in the 2nd word file. Please answer.
Thx in Advance.

Questions by DeRaj

Showing Answers 1 - 1 of 1 Answers

Mathi

  • Jun 24th, 2014
 

Code
  1. Set fso=CreateObject("scripting.filesystemobject")

  2. Set f1=fso.OpenTextFile("E:Testingword1.txt",1)

  3. While not f1.AtEndOfLine

  4.         rd1line=f1.ReadLine

  5.         If instr(1,rd1line,"i am string")=1 Then

  6.                 Set f2=fso.OpenTextFile("E:Testingword2.txt",1)

  7.                 While not f2.AtEndOfStream

  8.                         rd2line=f2.ReadLine

  9.                         If instr(1,rd2line,"i am string")=1 Then

  10.                         Set f3=fso.OpenTextFile("E:Testingword2.txt",8)

  11.                                 f3.Write("Sucessfull")

  12.                         End If

  13.                 Wend

  14.  

  15.         End If

  16. Wend



  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions