title: MS Word Find and Replace text within all docs in a folder using VBA
body: <p>I have come across the code below that searches through an open word document and performs a find and replace within all areas (StoryRanges) of the document.
  It works fine, however i would like to ask how i could modify this code to look at all documents in a chosen folder and perform the find and replace for all docs within that folder?, rather than just the active document which is open?  </p>
  
  <p>My plan is to assign the macro to a button in Excel so that the user can click that, navigate to the folder and action the find and replace across lots of documents at once.</p>
  
  <p>Am I able to amend the 'IN ActiveDocument.StoryRanges' section to look at a folder instead? I'm not sure what i can amend it to.  btw... i am new to vba and trying to research &amp; learn as i go... I very much appreciate your time, patience and any help you can give while i'm trying to find my feet with it - Alex.</p>
  
  <p>Dim myStoryRange As Range</p>
  
  <pre><code>    For Each myStoryRange In ActiveDocument.StoryRanges
      With myStoryRange.Find
          .Text = "Text to find to replace goes here"
          .Replacement.Text = "And the replacement text goes here"
          .Wrap = wdFindContinue
          .Execute Replace:=wdReplaceAll
      End With
      Do While Not (myStoryRange.NextStoryRange Is Nothing)
          Set myStoryRange = myStoryRange.NextStoryRange
          With myStoryRange.Find
              .Text = "Text to find to replace goes here"
              .Replacement.Text = "And the replacement text goes here"
              .Wrap = wdFindContinue
              .Execute Replace:=wdReplaceAll
          End With
      Loop
  Next myStoryRange
  </code></pre>