View Single Post
 
Old 08-04-2016, 04:55 AM
grumblid grumblid is offline Windows 7 64bit Office 2003
Novice
 
Join Date: Jul 2016
Posts: 25
grumblid is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
Modifying Graham's superior method to do that would be
Code:
Sub GetParas()
  Dim oDoc As Document
  Dim oRng As Range
  Dim strKeyWord As String
  strKeyWord = InputBox("Enter the word to find")
  If strKeyWord = "" Then GoTo lbl_Exit
  Set oRng = ActiveDocument.Range
  Set oDoc = Documents.Add
  With oRng.Find
    Do While .Execute(FindText:=strKeyWord, MatchCase:=False, MatchWholeWord:=True)
      oDoc.Range.InsertAfter oRng.Paragraphs(1).Range.FormattedText
      oRng.Paragraphs(1).Range.Delete
      oRng.Collapse 0
    Loop
  End With
  oDoc.Range.ParagraphFormat.SpaceBefore = 12
lbl_Exit:
  Exit Sub
End Sub
Perfect. This does exactly what I need it to! owo

Thank you so much, everyone. I'll get out of your hair now, though if I have problems in the future, I'll know where to go :]
Reply With Quote