View Single Post
 
Old 03-05-2020, 09:28 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:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim bShow As Boolean, RngFnd As Range
bShow = ActiveWindow.View.ShowHiddenText
ActiveWindow.View.ShowHiddenText = True
With ActiveDocument.Range
  If .Bookmarks.Exists("LastEntryThusFarMadeInTblOfExhibits") Then
    .Bookmarks("LastEntryThusFarMadeInTblOfExhibits").Delete
  End If
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "[FULLNAME: PDF] "
    .Replacement.Text = ""
    .Forward = False
    .Wrap = wdFindStop
    .Execute
  End With
  Do While .Find.Found
    If .Style = "Heading 1" Then
      If Selection.Paragraphs.First.Range.Start >= .Start Then Exit Do
    End If
    Set RngFnd = .Duplicate
    .Collapse wdCollapseStart
    .Find.Execute
  Loop
  If Not RngFnd Is Nothing Then .Bookmarks.Add Name:="LastEntryThusFarMadeInTblOfExhibits", Range:=RngFnd
End With
ActiveWindow.View.ShowHiddenText = bShow
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote