Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-05-2015, 08:17 PM
Guessed's Avatar
Guessed Guessed is offline Numbered Outline Continuation Headings Windows 7 32bit Numbered Outline Continuation Headings Office 2010 32bit
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default


Try the next iteration of the concept. It still has the bookmark uniqueness issue that I spoke about but the rest of it should show you how the code can arrive at the preceding heading's parent.
Code:
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
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Numbered Outline Continuation Headings Capturing numbered headings jbvalen Word VBA 5 05-04-2017 05:03 PM
Word Mixing Numbered Headings with Numbered List Tess0 Word 11 07-15-2014 05:25 AM
Numbered Outline Continuation Headings Headings and Number Outline Problem (MS Office 2008) triodia Word 2 05-07-2012 02:03 AM
Numbered Outline Continuation Headings numbered headings Caroline Word 5 03-14-2011 09:09 AM
XML marking of Auto-numbered Headings crose Word 0 12-17-2009 09:55 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:16 PM.


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