Hi, Lisa,
Outline Numbering has some control issues that work
differently than other style elements.
Even outside of VBA, when you go through Modify Style to
access the Customize Outline Numbered List dialog box and
make changes -- you are almost guaranteed to experience
some frustration with the outline.
The easier approach is to modify whatever character and
paragraph formatting (other than indents and any tab set
for the numbering) that you need to change for your
heading style in Modify Style. Then go into Format,
Bullets and Numbering, Outline Numbered, Customize to
make the numbering changes (including tabs and indents,
which is why they're noted not to edit in Modify Style --
they'll be overwritten by the settings made in
Customize). The style will be updated as long as the
modified outline level is linked to the heading style in
Customize Outline Numbered List.
The reason to approach it this way is that the settings
for the Outline Numbered gallery entries (the 7 most
recently used outline styles that you see when you go to
Format, Bullets and Numbering, Outline Numbered) are
stored in the Windows Registry (the location of system
settings for all of your applications). So, because
outline numbering functions 'above' the application
level, so to speak -- it's going to take precedence over
anything managed strictly in Word (such as styles).
In VBA, address this by editing the Outline Numbered list
formatting, and use the .Linked Style property to
assign\update the heading style to reflect your edits.
Here's some sample code for editing the first three level
of an outline attached to Headings 1, 2, and 3, styles
and then applying that outline as the active list.
(Notice that, in this example, if you were recording the
macro you would have started by clicking to select the
fourth gallery entry (i.e., 4th list template) and then
clicking customize to make your edits. If you record the
macro, it will provide many more settings (because
recorded macros record a value for every possible setting
in the dialog box) -- which will include settings, in
this case, for all 9 possible outline levels. You don't
need to redefine all nine levels, however, every time.
Here's an example for editing three levels:
Sub TestList()
With ListGalleries
(wdOutlineNumberGallery).ListTemplates(4).ListLevels(1)
.NumberFormat = "Article %1."
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleArabic
.NumberPosition = InchesToPoints(0)
.Alignment = wdListLevelAlignLeft
.TextPosition = InchesToPoints(0)
.TabPosition = InchesToPoints(1)
.ResetOnHigher = 0
.StartAt = 1
.LinkedStyle = "Heading 1"
End With
With ListGalleries
(wdOutlineNumberGallery).ListTemplates(4).ListLevels(2)
.NumberFormat = "Section %1.%2"
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleArabic
.NumberPosition = InchesToPoints(0)
.Alignment = wdListLevelAlignLeft
.TextPosition = InchesToPoints(0)
.TabPosition = InchesToPoints(0.75)
.ResetOnHigher = 1
.StartAt = 1
.Font.Bold = True
.LinkedStyle = "Heading 2"
End With
With ListGalleries
(wdOutlineNumberGallery).ListTemplates(4).ListLevels(3)
.NumberFormat = "%3."
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleUppercaseRoman
.NumberPosition = InchesToPoints(0.2)
.Alignment = wdListLevelAlignLeft
.TextPosition = InchesToPoints(0.5)
.TabPosition = InchesToPoints(0.5)
.ResetOnHigher = 2
.StartAt = 1
.LinkedStyle = "Heading 3"
End With
ListGalleries(wdOutlineNumberGallery).ListTemplates
(4).Name = ""
Selection.Range.ListFormat.ApplyListTemplate _
ListTemplate:=ListGalleries
(wdOutlineNumberGallery).ListTemplates(4),
ContinuePreviousList:=True,
ApplyTo:=wdListApplyToWholeList,
DefaultListBehavior:=wdWord10ListBehavior
End Sub
---------------------
Hope that helps. I'm going to be blogging on Outline
Numbered list issues later today ... will be up by this
evening for sure, if you want to check it out. My blog is
www.arouet.net
Best,
Stephanie Krieger
author of Microsoft Office Document Designer (from
Microsoft Learning)
email: MODD_2003 at msn dot com
blog: arouet.net