View Single Post
 
Old 01-02-2017, 09:50 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Use a SEQ field for the chapter numbers then if you change the orrder again you can update the field to change the numbers e.g.

Code:
Sub Makro7()
Dim oRng As Range
Dim oFound As Range
    Set oRng = ActiveDocument.Range
    With oRng.Find
        Do While .Execute(FindText:="Chapter")
            Set oFound = oRng
            oRng.Collapse 0
            oRng.Fields.Add oRng, wdFieldSequence, "ChapterNum", False
            oRng.InsertBefore Chr(32)
            oFound.End = oRng.End
            oFound.Style = "Heading 1"
            oRng.Collapse 0
        Loop
    End With
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote