Thread: [Solved] Get next paragraph
View Single Post
 
Old 09-05-2016, 08:41 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,142
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

I assume you only want to find the first instance?

Code:
Sub ShowPARA()
Dim p As Paragraph, pp As String
Dim pp2 As String
    For Each p In ActiveDocument.Paragraphs
        pp = p.Range.Text
        If Not p.Range.End = ActiveDocument.Range.End Then
            pp2 = p.Range.Next.Paragraphs(1).Range.Text
        Else: pp2 = ""
        End If
        If Val(pp) > 279 Then
Debug.Print pp & pp2 & vbCr
            Exit For    'stop processing the loop
        End If
    Next p
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote