Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-10-2016, 06:06 PM
Irene H Irene H is offline Numbered Outline Continuation Headings Windows 10 Numbered Outline Continuation Headings Office 2016
Novice
 
Join Date: Jul 2016
Posts: 3
Irene H is on a distinguished road
Default

Hello,

I am working on something similar -

I've only gone to level 3 Heading, and still have a bit to do with building the rest of the clause number. This might help you get started. (I haven't included the full code below, but hopefully will give you a start).




Do While i <= ActiveDocument.Paragraphs.Count
Set para = ActiveDocument.Paragraphs(i)
Select Case (para.Style)

Case "Heading 1": ' this is the major heading
iHeading1 = iHeading1 + 1
sHeading1 = para.Range

If iHeading1 < 1 Then
sClauseH1 = ""
Else: sClauseH1 = Format(iHeading1, Text) & "."

End If


'Reset Heading 2 and 3
iHeading2 = 0
sHeading2 = ""
iHeading3 = 0
sHeading3 = ""

Case "Heading 2": ' this is the level 2 heading
iHeading2 = iHeading2 + 1


sHeading2 = para.Range
If iHeading2 < 1 Then
sClauseH2 = ""
Else: sClauseH2 = Format(iHeading2, Text) & "."

End If
'Reset Heading 3
iHeading3 = 0
sHeading3 = ""

Case "Heading 3" ' this is the level 3 heading
iHeading3 = iHeading3 + 1
sHeading3 = para.Range

If iHeading3 < 1 Then
sClauseH3 = ""
Else: sClauseH3 = Format(iHeading2, Text) & "."

End If


Case "Normal":
' we want to copy the text (and paste all our variables in the excel spreadsheet)
sString = para.Range

Dim rng As Range
Dim strnum As String
ActiveDocument.ConvertNumbersToText
Set rng = Selection.Paragraphs(1).Range
sClause = sClauseH1 & sClauseH2 & sClauseH3 & Left(sString, InStr(sString, vbTab))
ActiveDocument.Undo
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 06: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