Advertisement
vargap

vba2

Jul 24th, 2014
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.    Dim myStoryRange As Range
  2.  
  3.  
  4.         For Each myStoryRange In ActiveDocument.StoryRanges
  5.         With myStoryRange.Find
  6.             .Text = "Text to find to replace goes here"
  7.             .Replacement.Text = "And the replacement text goes here"
  8.             .Wrap = wdFindContinue
  9.             .Execute Replace:=wdReplaceAll
  10.         End With
  11.         Do While Not (myStoryRange.NextStoryRange Is Nothing)
  12.             Set myStoryRange = myStoryRange.NextStoryRange
  13.             With myStoryRange.Find
  14.                 .Text = "Text to find to replace goes here"
  15.                 .Replacement.Text = "And the replacement text goes here"
  16.                 .Wrap = wdFindContinue
  17.                 .Execute Replace:=wdReplaceAll
  18.             End With
  19.         Loop
  20.     Next myStoryRange
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement