title: Replace a word in text file with another word using macro
body: <p>The below code is working for me to replace a word ("This") in text file to another word ("That").Similarly i need to replace one more word with in the same text file.</p>
  
  <p>my requirement is replace the word "This" to "That"
  and replace "From" to "TO".Can you modify the below code accordingly.</p>
  
  <pre><code> Sub  ReplaceStringInFile()
  
      Dim objFSO As Object
      Dim objFil As Object
      Dim objFil2 As Object
      Dim StrFileName As String
      Dim StrFolder As String
      Dim SstrAll As String
  
      Set objFSO = CreateObject("scripting.filesystemobject")
      StrFolder = "c:\macro\"
      StrFileName = Dir(StrFolder &amp; "*.txt")
  
      Do While StrFileName &lt;&gt; vbNullString
          Set objFil = objFSO.opentextfile(StrFolder &amp; StrFileName)
          strAll = objFil.readall
          objFil.Close
          Set objFil2 = objFSO.createtextfile(StrFolder &amp; StrFileName)
          objFil2.Write Replace(strAll, "THIS", "THAT")
          objFil2.Close
          StrFileName = Dir
      Loop
      End Sub
  </code></pre>