View Single Post
 
Old 09-08-2018, 03:32 PM
jeffreybrown jeffreybrown is offline Windows Vista Office 2007
Expert
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default Select pagagraphs between two words and run macro

This macro is working fine to select all of the paragraphs between two specific words, but it's also selecting the end of the first word thereby changing the style on the first word. I would only like the paragraphs in-between the two words selected.

Is there an adjustment that can be made with this macro?

Code:
Sub RevisedFindIt()
    Dim rng1 As Range
    Dim rng2 As Range
    Dim strTheText As String
    Set rng1 = ActiveDocument.Range
    If rng1.Find.Execute(FindText:="References") Then
        Set rng2 = ActiveDocument.Range(rng1.End, ActiveDocument.Range.End)
        If rng2.Find.Execute(FindText:="Abbreviations and Acronyms") Then
            ActiveDocument.Range(rng1.End, rng2.Start).Select
            Call Format_AFI_References
        End If
    End If
End Sub
References

Paragraph 1
Paragraph 2
Paragraph 3
etc.,

Abbreviations and Acronyms
Reply With Quote