Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-11-2020, 01:14 PM
stanley stanley is offline Applying New Multi-Level List to Existing Document with Manual Numbering and Existing Styles Mac OS X Applying New Multi-Level List to Existing Document with Manual Numbering and Existing Styles Office 2016 for Mac
Novice
Applying New Multi-Level List to Existing Document with Manual Numbering and Existing Styles
 
Join Date: Dec 2020
Posts: 3
stanley is on a distinguished road
Default Applying New Multi-Level List to Existing Document with Manual Numbering and Existing Styles

OK, big job to do and trying to figure out the most efficient workflow.

I've got about 100 documents (construction specifications) that are essentially long multi-level lists (unfortunately, can't post an example without permission). Think one big outline for 5-10 pages.

Each level of the list already has its own style, but the numbering/lettering was done manually a million years ago. This results in a ton of manual renumbering each time we edit these for a new project.

My goal is to get these documents to auto-number for us in the future. What's the best way to go about this?

The closest I've gotten is creating a new multi-level list and linking each level to the corresponding existing style, which results in a lot of cleanup of redundant numbers, with the new auto-number added in front of the existing, for example:

2. PRODUCTS

becomes

2. 2. PRODUCTS

Is there a way to get the existing numbers to auto-number instead? Or perhaps an efficient way to clean up the resulting mess of the above process?

Grateful for any suggestions. Thanks!
Reply With Quote
  #2  
Old 12-11-2020, 01:51 PM
macropod's Avatar
macropod macropod is online now Applying New Multi-Level List to Existing Document with Manual Numbering and Existing Styles Windows 10 Applying New Multi-Level List to Existing Document with Manual Numbering and Existing Styles Office 2010
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The following two macros should do the job for you.

The first applies multi-level list numbering to Word's Heading Styles:
Code:
Sub ApplyMultiLevelHeadingNumbers()
Dim LT As ListTemplate, i As Long
Set LT = ActiveDocument.ListTemplates.Add(OutlineNumbered:=True)
For i = 1 To 9
  With LT.ListLevels(i)
    .NumberFormat = Choose(i, "%1", "%1.%2", "%1.%2.%3", "%1.%2.%3.%4", "%1.%2.%3.%4.%5", "%1.%2.%3.%4.%5.%6", "%1.%2.%3.%4.%5.%6.%7", "%1.%2.%3.%4.%5.%6.%7.%8", "%1.%2.%3.%4.%5.%6.%7.%8.%9")
    .TrailingCharacter = wdTrailingTab
    .NumberStyle = wdListNumberStyleArabic
    .NumberPosition = CentimetersToPoints(-0.5 + i * 0.5)
    .Alignment = wdListLevelAlignLeft
    .TextPosition = CentimetersToPoints(1 + i * 0.5)
    .ResetOnHigher = True
    .StartAt = 1
    .LinkedStyle = "Heading " & i
  End With
Next
End Sub
Headings and their numbers are also indented (in 0.5cm increments) according to their level, though you can change that (e.g. InchesToPoints using instead of CentimetersToPoints would change the indents to 0.5in).

The second macro converts your existing manual numbering to the applicable auto-numbered Heading Styles.
Code:
Sub ApplyHeadingStyles()
Dim Para As Paragraph, Rng As Range, iLvl As Long
With ActiveDocument.Range
  For Each Para In .Paragraphs
    Set Rng = Para.Range.Words.First
    With Rng
      If IsNumeric(.Text) Then
        While .Characters.Last.Next.Text Like "[0-9. " & vbTab & "]"
          .End = .End + 1
        Wend
        iLvl = UBound(Split(.Text, "."))
        If IsNumeric(Split(.Text, ".")(UBound(Split(.Text, ".")))) Then iLvl = iLvl + 1
        If iLvl < 10 Then
          .Text = ""
          Para.Style = "Heading " & iLvl
        End If
      End If
    End With
  Next
End With
End Sub
You may want to change other aspects of the Heading Style formatting to better suit your layout requirements.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 12-12-2020, 03:29 AM
Guessed's Avatar
Guessed Guessed is offline Applying New Multi-Level List to Existing Document with Manual Numbering and Existing Styles Windows 10 Applying New Multi-Level List to Existing Document with Manual Numbering and Existing Styles Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,969
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

I don't know whether this will work on a Mac but there is a very old WordBasic command that removes the manual numbering. Try this macro on your selected text in your file
Code:
'====================================================
Sub NumberingDeleteHardcoded()
  'Only acts on selected paragraphs
  Dim iResp As Integer
  iResp = MsgBox("This macro will remove all hardcoded paragraph numbers " _
    & vbCr & "from the SELECTED paragraphs. Click OK to continue.", _
    vbOKCancel, "Delete Hard Numbers")
  If iResp = vbOK Then
    WordBasic.ToolsBulletsNumbers Replace:=0, Type:=1, Remove:=1
  End If
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #4  
Old 12-14-2020, 06:36 AM
stanley stanley is offline Applying New Multi-Level List to Existing Document with Manual Numbering and Existing Styles Mac OS X Applying New Multi-Level List to Existing Document with Manual Numbering and Existing Styles Office 2016 for Mac
Novice
Applying New Multi-Level List to Existing Document with Manual Numbering and Existing Styles
 
Join Date: Dec 2020
Posts: 3
stanley is on a distinguished road
Default

Thanks both—I'll give these a try and report back.
Reply With Quote
  #5  
Old 12-15-2020, 10:59 AM
stanley stanley is offline Applying New Multi-Level List to Existing Document with Manual Numbering and Existing Styles Mac OS X Applying New Multi-Level List to Existing Document with Manual Numbering and Existing Styles Office 2016 for Mac
Novice
Applying New Multi-Level List to Existing Document with Manual Numbering and Existing Styles
 
Join Date: Dec 2020
Posts: 3
stanley is on a distinguished road
Default

Update to say that I was able to work out a combination approach. Unfortunately my company's existing styles aren't "headers," and I'm not good enough with macros to edit the code to work with our existing styles.

What worked was creating a new list style in a template and pasting each document in, and cleaning up with that old WordBasic command to delete the hard numbering. (Which does in fact work on a Mac!).

About a minute per file, fast enough for me!

Thanks again.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Does a new set of styles in a template overwrite or remove the existing set of styles in a document? dianahbr Word 6 03-27-2018 11:12 PM
Applying New Multi-Level List to Existing Document with Manual Numbering and Existing Styles Multi-level numbering / styles Andy Pilkington Word 4 09-11-2014 05:29 AM
How 2: Different Styles in Multi-Level List BrianWren Word 1 10-21-2013 08:50 AM
Multi Level List Numbering ShelleyHoward Word 2 01-05-2012 01:37 PM
Applying New Multi-Level List to Existing Document with Manual Numbering and Existing Styles Multi-level list styles qochi Word 1 05-31-2011 01:16 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:32 PM.


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