Hi Macropod, so I have figured out the issue with the Define new Multilevel List, I just needed to update the code which now updates the dialog box correctly.
Code:
.NumberPosition = InchesToPoints(Choose(i, 0, 0, 0.5, 1, 1.5, 2, 2.5))
.TextPosition = InchesToPoints(Choose(i, 0.5, 0.5, 1, 1.5, 2, 2.5, 3))
You mentioned in a previous post why do I use two Heading 2 levels, one is set up to be plain text and the second one (Heading 2(Title) is when Heading 2 is a bold title within the same document. Heading 2(Title) is set up as style based on Heading 2 but when running one of my applymultilevel codes Heading 2(Title) does not update and therefore the numbering doesn't follow in sequence. Does VBA class this as another style even though its based on Heading 2?
Capture.PNG
Code:
Sub ApplyMultiLevelHeadingNumbers_B()
'Run if Heading 4 is numbered (a)
Application.ScreenUpdating = False
Dim LT As ListTemplate, i As Long, n As Long, iLvl As Long
Call DPU_RemoveFirstLineIndents
Set LT = ActiveDocument.ListTemplates.Add(OutlineNumbered:=True)
For i = 1 To 6
With LT.ListLevels(i)
.NumberFormat = Choose(i, "%1.", "%1.%2", "%1.%2.%3", "(%4)", "(%5)", "(%6)", "(%7)")
.TrailingCharacter = wdTrailingTab
.NumberStyle = Choose(i, wdListNumberStyleArabic, wdListNumberStyleArabic, _
wdListNumberStyleArabic, wdListNumberStyleLowercaseLetter, wdListNumberStyleLowercaseRoman, _
wdListNumberStyleUppercaseLetter, wdListNumberStyleArabic)
.NumberPosition = InchesToPoints(Choose(i, 0, 0, 0.5, 1, 1.5, 2, 2.5))
.TextPosition = InchesToPoints(Choose(i, 0.5, 0.5, 1, 1.5, 2, 2.5, 3))
.Font.Bold = Choose(i, 0, 0, 0, 0, 0, 0, 0) 'Remove bold from heading numbers
.Alignment = wdListLevelAlignLeft
.ResetOnHigher = True
.StartAt = 1
.LinkedStyle = "Heading " & i
End With
With ActiveDocument.Styles("Heading " & i)
Select Case i
Case 1, 2
.ParagraphFormat.LeftIndent = InchesToPoints(0.5)
Case Else
.ParagraphFormat.LeftIndent = InchesToPoints((i - 1) * 0.5)
End Select
.ParagraphFormat.FirstLineIndent = InchesToPoints(-0.5)
.ParagraphFormat.Alignment = wdAlignParagraphJustify
.Font.Name = "Arial"
.Font.Italic = False
.Font.ColorIndex = wdAuto
.Font.Size = 10
End With
Next
Application.ScreenUpdating = True
'Call ApplyHeadingStyles_IfManual
End Sub