View Single Post
 
Old 04-27-2022, 06:28 AM
macropod's Avatar
macropod macropod is offline Windows 10 Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

The bookmarks are deleted because the content they were attached to gets deleted. The workaround requires something like (untested) -

Change:
Code:
Dim Sctn1 As Section, Sctn2 As Section
to:
Code:
Dim Sctn1 As Section, Sctn2 As Section, BkMk As Bookmark, x As Long, y As Long
After:
Code:
          .FormattedText = Sctn1.Footers(oHdFt.Index).Range.FormattedText
insert:
Code:
          For Each BkMk In Sctn1.Footers(oHdFt.Index).Range
            x = BkMk.Range.Start: y = BkMk.Range.End
            .Bookmarks.Add Name:=BkMk.Name, Range:=.SetRange(x, y)
          Next
After:
Code:
          .FormattedText = Sctn1.Headers(oHdFt.Index).Range.FormattedText
insert:
Code:
          For Each BkMk In Sctn1.Headers(oHdFt.Index).Range
            x = BkMk.Range.Start: y = BkMk.Range.End
            .Bookmarks.Add Name:=BkMk.Name, Range:=.SetRange(x, y)
          Next
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote