Ending outline numbered lists when linked to paragraph style

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Does anyone know a way to control what style is set when the user hits enter
twice in an outline numbered list?

Alternatively, (and I'm only going here in desperation) is there a way to
assign a macro to a "double-enter" on the keyboard which would then check the
current style, then check whether there are any numbers or bullets present
and if not (so the user is ending the list) apply the Body Text style?

Here's the background:

I've created my list styles, following all the advice out there on the MVP
sites, using this basic method:
'1) Create a new paragraph style:
Dim StyleName1 As String
StyleName1 = "something"
ActiveDocument.Styles.Add Name:=StyleName1, _
Type:=wdStyleTypeParagraph

'2) Define Font and Paragraph settings
With ActiveDocument.Styles(StyleName1)
.AutomaticallyUpdate = False
.BaseStyle = "" 'No style
.NextParagraphStyle = StyleName1
With .Font
.Name = "Arial"
.Size = 11
.Bold = True
End With
With .ParagraphFormat
.LeftIndent = CentimetersToPoints(-1.5)
End With
End With

'3) Created new paragraph styles for the other levels in the list
With ActiveDocument.Styles(StyleName2)
.AutomaticallyUpdate = False
.BaseStyle = StyleName1
.NextParagraphStyle = StyleName2
End With
'etc...

'4) Create a new ListTemplate (with a name)
ActiveDocument.ListTemplates.Add OutlineNumbered:=True, _
Name:="MyListTemplate"

'5) Define the settings for each ListLevel:
'DEFINE OUTLINE NUMBERED LIST SETTINGS
Set ltTemp = ActiveDocument.ListTemplates("MyListTemplate")
'Note the above works despite the Help for ListTemplates.Add
saying:
'"You cannot use this name to index the list template in the
collection."
'It only works if you use the above syntax,
'OR if you asign the name to a variant (NOT a string!), e.g.:
'Dim MyLTName As Variant
'MyLTName = "MyListTemplate"
'Set ltTemp = ActiveDocument.ListTemplates(MyLTName)

'NUMBER FORMAT
ltTemp.ListLevels(1).NumberFormat = "%1" '1, 2, 3...
ltTemp.ListLevels(2).NumberFormat = "%1%2" '1A, 1B, 1C, 2A, 2B, 2C...

'NUMBER STYLE
ltTemp.ListLevels(1).NumberStyle = wdListNumberStyleArabic '1,
2, 3...
ltTemp.ListLevels(2).NumberStyle = wdListNumberStyleUppercaseLetter 'A,
B...

'RESET ON HIGHER
For j = 1 To 2
ltTemp.ListLevels(j).ResetOnHigher = j - 1
Next j

'etc... for all the other settings

'6) Link each ListLevel to the correct paragraph style:
'LINKED STYLE
ltTemp.ListLevels(1).LinkedStyle = StyleName1
ltTemp.ListLevels(2).LinkedStyle = StyleName2

This all works very well with one major issue. If you use the automatic
numbered lists in Word, when you hit enter twice (see note below), the list
ends and the resulting two new paragraphs have the Normal style.

But, assuming you set up the list styles to be followed by themselves:
ActiveDocument.Styles(StyleName1).NextParagraphStyle = StyleName1
when you hit enter twice the style stays as my paragraph style, but the
numbering (or bullets) disappear on the two new lines! The user now has
lines of text that look like Body Text, but are still actually the StyleName1
style minus the numbers.

So, does anyone know a way to control what style is set when the user ends
an outline numbered list?

Alternatively, (and I'm only going here in desperation) is there a way to
assign a macro to a "double-enter" on the keyboard which would then check the
current style, then check whether there are any numbers or bullets present,
and if not (...then the user is ending the list...) apply the Body Text style?

(Note: technically, it isn't "enter twice", it's when the user hits enter
when there is no other text in the numbered paragraph - that should really be
the trigger for any macro that sets the style for the subsequent paragraph).

Many thanks (especially for reading all the way to here!).

Cheers
Rich
.



Relevant Pages

  • Re: Style for Hanging Indent in numbered paragraph
    ... It appears if you use Format>Bullets and Numbering: ... So it will be a member of some "group" to use your analogy that follows. ... A paragraph is always a member of "Paragraphs". ... You don't NEED to remove lists from ...
    (microsoft.public.mac.office.word)
  • Re: Style for Hanging Indent in numbered paragraph
    ... Numbering dialog. ... paragraphs, some may be members, and some paragraphs may not. ... The properties determine the behaviour of the paragraph (its ... The paragraphs are each members of one of two hidden lists. ...
    (microsoft.public.mac.office.word)
  • Re: Style for Hanging Indent in numbered paragraph
    ... but if you want to use Heading Numbering in ... of lists in a document. ... paragraph style that contains the level number. ...
    (microsoft.public.mac.office.word)
  • Re: Unexpected alignment when using styles for headings 1, 1.1, 1.
    ... The reason to place the insertion point in the first top-level paragraph of ... a list (which for heading numbering means the first Heading 1 paragraph of ... modification with the insertion point elsewhere. ... "Why does Word restart the lists?" ...
    (microsoft.public.word.docmanagement)
  • Re: Style for Hanging Indent in numbered paragraph
    ... The Outline lists display nine levels and are most often ... employed for paragraph bullets or numbering. ... value as the left indent of your base paragraph style. ...
    (microsoft.public.mac.office.word)