View Single Post
 
Old 08-19-2017, 02:43 AM
rdross51 rdross51 is offline Windows 7 32bit Office 2010 32bit
Advanced Beginner
 
Join Date: Feb 2015
Location: Abu Dhabi
Posts: 45
rdross51 is on a distinguished road
Default Numbered Outline Continuation Headings

Although the last iteration from Guessed (dated 3/6/2015) works and can be repeated throughout the document, it applies the same bookmark name to each continuation heading so when you update the document (and fields), all references change to the last entry. I still am unable to figure out how to increment the bookmark so that each continuation heading will have a unique name. I am not a programmer and I've hit a wall on this. If no one can provide a free solution, I am at the point were I am willing to pay for one. Here was the last code provided.
Sub ProofOfConcept()
'macro by Andrew Lockton
Dim aRng As Range, iLev As Integer
Set aRng = ActiveDocument.Bookmarks("\page").Range
aRng.InsertParagraphBefore
With aRng.Paragraphs(1)
.Style = "Normal"
.OutlinePromote
iLev = .OutlineLevel
If iLev > 3 Then
.Style = "Normal"
aRng.Collapse Direction:=wdCollapseStart
aRng.Select
Selection.GoTo What:=wdGoToHeading, Which:=wdGoToPrevious, Count:=1
While Selection.Paragraphs(1).OutlineLevel <> iLev - 1
Selection.GoTo What:=wdGoToHeading, Which:=wdGoToPrevious, Count:=1
Wend

ActiveDocument.Bookmarks.Add Name:="ABC", Range:=Selection.Range
aRng.InsertAfter " continued"
aRng.Collapse Direction:=wdCollapseStart
ActiveDocument.Fields.Add Range:=aRng, Text:="Ref ABC \w \h"
aRng.Select
Else
aRng.Paragraphs(1).Range.Delete
End If
End With
End Sub
Reply With Quote