View Single Post
 
Old 08-17-2020, 09:11 AM
Charles Kenyon Charles Kenyon is offline Windows 10 Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,140
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

That is not "normal" for Word even if it is for you. There is a difference between a sentence and a paragraph, especially in Word.
2.2 Why you should press Enter only once to end a paragraph


This might do what you want.


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
      oDoc.Range.InsertParagraphAfter
      oRng.Paragraphs(1).Range.Delete
      oRng.Collapse 0
    Loop
  End With
  oDoc.Range.ParagraphFormat.SpaceBefore = 0
  oDoc.Range.ParagraphFormat.SpaceAfter = 0
lbl_Exit:
  Exit Sub
 End Sub

Nothing wrong with Word 2003. However, I do not have it on my computer so have not tested the macro. I know of no reason why it would not work, though. If you decide to "upgrade" do not get Word 2007. IMO, it was a beta version pushed out by marketing.
Reply With Quote