Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 01-02-2017, 09:50 PM
gmayor's Avatar
gmayor gmayor is offline Need VBA to renumber chapters Windows 10 Need VBA to renumber chapters Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
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 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
 

Tags
chapter titles, vba in microsoft word

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need VBA to renumber chapters I want a Word 2013 table to automatically renumber the list when I add a new row into the middle. ar8294 Word Tables 7 07-03-2016 01:58 PM
Need VBA to renumber chapters Renumber and Multi-Level List functions don't work? ar8294 Word Tables 2 07-03-2016 10:49 AM
How to number chapters and sub-chapters in a few clicks? Icelandic_Boy Word 1 05-24-2016 11:33 AM
Need VBA to renumber chapters Chapters only Table of Contents SQLUSA Word 2 07-04-2012 03:36 PM
Page numbering - Chapters Andrew Thorpe Word 0 08-04-2010 11:04 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:11 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft