![]() |
|
|||||||
|
|
|
Thread Tools | Display Modes |
|
|
|
#1
|
|||
|
|||
|
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! |
|
#2
|
||||
|
||||
|
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
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
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
||||
|
||||
|
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 |
|
#4
|
|||
|
|||
|
Thanks both—I'll give these a try and report back.
|
|
#5
|
|||
|
|||
|
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. |
|
|
|
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 |
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 |
Multi-level list styles
|
qochi | Word | 1 | 05-31-2011 01:16 AM |