ListGalleries vs <what-else?>
I am trying to automatically format my List styles in Word.
But, being that I'm very new to VBA and only need VBA for this one project, I'm doing a whole lot of trial-and-error to get this to work.
I can't quite get the number formats for the ListLevels. I want my Outlined Numbered list to use the following format
SAMPLE 1
1 <my title>
1.1 <my sub title>
1.2 <my sub title>
2 <my title>
2.1 <my sub title>
2.2 <my sub title>
2.3 <my sub title>
3 <my title>
(etc...)
And all I get is:
SAMPLE 2
1 <my title>
1.1 <my sub title>
1.1 <my sub title>
2 <my title>
2.2 <my sub title>
2.2 <my sub title>
2.2 <my sub title>
3 <my title>
(etc...)
(Later, I'll ask how I can specify a paragraph to have List Level 2. I haven't been able to autmoate that either.)
A long while back (when talking about ListGalleries) si_the_geek said "Hmmm, I've never seen ListGalleries before..." which makes me wonder what other ways there are to do this.
Anyway, here is my cod that formats the ListGalleries (the wrong way).
VB Code:
m = 1
Do While (m < 5)
With objWord.ListGalleries(wdOutlineNumberGallery).ListTemplates(3).ListLevels(m)
If (m = 1) Then
.NumberFormat = "%1"
.StartAt = 1
.ResetOnHigher = False
ElseIf (m = 2) Then
.NumberFormat = "%1.%1"
.StartAt = 1
.ResetOnHigher = False
ElseIf (m = 3) Then
.NumberFormat = "%1.%1.%1"
.ResetOnHigher = True
ElseIf (m = 4) Then
.NumberFormat = "%1.%1.%1.%1"
.ResetOnHigher = True
End If
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleArabic
.Alignment = wdListLevelAlignLeft
'.ResetOnHigher = 0
End With
m = m + 1
Loop
Maybe my code to format the title
VB Code:
.Range.ListFormat.ApplyNumberDefault 'e.g. 1.
is the problem.
Melissa