View Single Post
 
Old 09-08-2018, 04:02 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try something along the lines of:
Code:
Sub Find_AFI_Ref()
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "References*Abbreviations and Acronyms"
    .Replacement.Text = ""
    .Forward = True
    .Format = False
    .MatchWildcards = True
    .Wrap = wdFindStop
    .Execute
  End With
  If .Find.Found = True Then
    .Start = .Paragraphs.First.Range.End
    .End = .Paragraphs.Last.Range.Start
    Call Format_AFI_References(.Duplicate)
  End If
End Sub
Note how the code passes the relevant range to Format_AFI_References, which you would now code as:
Code:
Sub Format_AFI_References(Rng as Range)
With Rng
…
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote