Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 07-19-2022, 04:45 AM
Guessed's Avatar
Guessed Guessed is offline Multilevel numbering - Two styles for the same level? Windows 10 Multilevel numbering - Two styles for the same level? Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,185
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

Yes it can be done but it can be a bit fragile so I use macros to create or destroy the 'numbered body text styles' if they are needed.

Let's say your template already contains the properly defined outline numbers and they are linked to the full set of built-in Heading styles. You can then create the body text partner styles for all of these by creating a style based on that Heading and then changing its attributes to resemble the Normal style.

The code I use to create and remove the styles is this...
Code:
Sub DeleteNormNumStyles()
  Dim sBaseName As String, i As Integer
  sBaseName = "Normal H"
  On Error Resume Next    'avoid error where style doesn't exist
  For i = 1 To 9
    ActiveDocument.Styles(sBaseName & i).BaseStyle = "Normal"   'change base style so paragraphs revert to Normal when style deleted
    ActiveDocument.Styles(sBaseName & i).Delete
  Next i
  On Error GoTo 0   'turn on error checking again
End Sub

'============================================
Sub CreateNormNumStyles()
  Dim sBaseName As String, i As Integer, aStyNormal As Style, aLT As ListTemplate
  
  sBaseName = "Normal H"
  Set aStyNormal = ActiveDocument.Styles(wdStyleNormal)
  Set aLT = ActiveDocument.Styles(wdStyleHeading1).ListTemplate
  Debug.Print "Outline: " & aLT.OutlineNumbered
  
  DeleteNormNumStyles   'removes styles if names already used in this doc
  
  For i = 1 To 9
    ActiveDocument.Styles.Add sBaseName & i, wdStyleTypeParagraph
    With ActiveDocument.Styles(sBaseName & i)
      .BaseStyle = "Heading " & i
      .ParagraphFormat = ActiveDocument.Styles("Heading " & i).ParagraphFormat
      .Font = aStyNormal.Font             'all the same font settings as Normal
      .ParagraphFormat.SpaceAfter = aStyNormal.ParagraphFormat.SpaceAfter
      .ParagraphFormat.SpaceBefore = aStyNormal.ParagraphFormat.SpaceBefore
      .ParagraphFormat.KeepWithNext = False
    End With
  Next i
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
 

Tags
legal, multilevel, numbering



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multilevel numbering - Two styles for the same level? Multilevel list level 6 not restarting after level 5 Venteux Word 12 04-22-2022 06:43 AM
Multilevel numbering - Two styles for the same level? Applying New Multi-Level List to Existing Document with Manual Numbering and Existing Styles stanley Word 4 12-15-2020 10:59 AM
Multilevel numbering in styles, how to not start at 1? Word 2016 Jd042 Word 2 09-13-2018 04:10 AM
Multilevel numbering - Two styles for the same level? Multi-level numbering / styles Andy Pilkington Word 4 09-11-2014 05:29 AM
Multilevel numbering - Two styles for the same level? Heading level numbering in 2010 - wrong after second header level 1 taran Word 3 07-08-2013 01:12 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:21 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