Results 1 to 8 of 8
  1. #1
    5 Star Lounger st3333ve's Avatar
    Join Date
    May 2003
    Location
    Los Angeles, California, USA
    Posts
    705
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Restart changes list template to outline (Word 2002 SP-2)

    I've set up several custom list styles, each linked to a separate list template from the Number gallery.

    The following code (previously posted by Andrew Lockton) will restart the numbering for one of these list styles:

    Set oList = theRange.ListFormat
    oList.ApplyListTemplate ListTemplate:=oList.ListTemplate, _
    ContinuePreviousList:=False

    So will the following variation (which I think I got from the MVPs site):

    theRange.ListFormat.ApplyListTemplate _
    ListTemplate:=theRange.Style.ListTemplate, _
    ContinuePreviousList:=False, _
    ApplyTo:=wdListApplyToWholeList, _
    DefaultListBehavior:=wdWord10ListBehavior

    Unfortunately, there's a problem with both those approaches: They change the numbering type for the style from Numbering to Outline Numbering. There's no visible change (i.e., level 1 of the Outline Numbering template has the same formatting that the original Numbering template had), but the result is still obviously undesirable assuming there's some reason to set up a custom style with Numbering rather than Outline Numbering in the first place. (Is there?)

    The following code (which is based on what gets recorded if you restart the numbering from the shortcut menu) restarts the numbering AND leaves the numbering type as Numbering:

    theRange.ListFormat.ApplyListTemplate _
    ListTemplate:=ListGalleries(wdNumberGallery).ListT emplates(4), _
    ContinuePreviousList:=False, _
    ApplyTo:=wdListApplyToWholeList, _
    DefaultListBehavior:=wdWord10ListBehavior

    But the problem with this code is: What if the list isn't linked to the 4th template in the gallery?

    I have 3 questions:

    1. Is there VBA to ascertain which gallery position a particular list is linked to?

    2. Does anyone already have some alternative code that restarts a Numbered list without changing its style to Outline Numbered?

    3. I'd appreciate any background light any list template gurus would care to shed on this whole situation. For example, when the list type flips from Numbered to Outline Numbered, has the style become linked to a substitute list template, or is the style still linked to the same list template but the list template has "migrated" from the Number gallery to the Outline Number gallery?

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Restart changes list template to outline (Word 2002 SP-2)

    I haven't tried this, so it is only a guess.

    Could you give your list template a name, and then use that name instead of the 4 in
    <code>ListTemplate:=ListGalleries(wdNumberGallery) .ListTemplates(strMyListName), _</code>

    Answering my own question - I've tried it now. You can name it, and retrieve the name, but you can't reference it by name. So I think you would need code that stepped through each ListTemplate in the Gallery checking to see if it matched the named one you had created.

    StuartR

  3. #3
    5 Star Lounger st3333ve's Avatar
    Join Date
    May 2003
    Location
    Los Angeles, California, USA
    Posts
    705
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Restart changes list template to outline (Word 2002 SP-2)

    After my initial post it occurred to me that ascertaining gallery position wouldn't be much of a solution anyway, since the gallery only consists of the 7 templates that get displayed at any given moment, which don't necessarily include all the list templates in use in the document.

    But I've done some further experimenting, and can now (very) tentatively report that the following code (which I'm repeating from my initial post) seems to be an all-purpose Restart solution:

    theRange.ListFormat.ApplyListTemplate _
    ListTemplate:=ListGalleries(wdNumberGallery).ListT emplates(4), _
    ContinuePreviousList:=False, _
    ApplyTo:=wdListApplyToWholeList, _
    DefaultListBehavior:=wdWord10ListBehavior

    Not only doesn't it seem to matter whether the list style you're restarting is linked to the list template in the 4th position in the Number gallery, it also doesn't seem to matter if the list template is a Number list template. The code works for styles linked to Outline Number list templates as well. And in both cases, it leaves the list template type unmessed-with -- i.e., unlike the more respectable-looking VBA restart routines, this embarrassing approach also leaves Numbered styles as Numbered styles, instead of flipping them to Outline Numbered styles.

    I'd be interested in knowing if others can replicate my initial problem and tentative solution.

    UPDATE: Never mind. My tentative solution has glitches of its own. (It seems to leave the style and its associated list template properly unmodified, but the actual visible numbering format may change -- i.e., become inconsistent with the style, which you can verify because it changes back to the old formatting if you reapply the style to the paragraph.) Still searching for the perfect solution...

  4. #4
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Restart changes list template to outline (Word

    If you look through WordsNumberingExplained, there is a link to an article "How to cure Word's List Numbering with a dose of VBA". For some reason, this 2nd link isn't active right now, but hopefully it's just a glitch.
    Hope this help,

  5. #5
    5 Star Lounger st3333ve's Avatar
    Join Date
    May 2003
    Location
    Los Angeles, California, USA
    Posts
    705
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Restart changes list template to outline (Word

    I've mentioned that article in previous posts and have never managed to obtain a copy. As far as I can tell, it's been unavailable for a long, long time.

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Restart changes list template to outline (Word

    For stuff from the past, Archive.org can be a goldmine.

  7. #7
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Restart changes list template to outline (Word

    Dave Rado never finished it the way he intended to. It was always just a collection of links.

    And maybe you needn't worry about the list "changing" to an outline list:
    Below the hood, Word always uses a full 9-level outline list template even for simple numbering/bullets... it just hides that fact.

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16> Klaus

  8. #8
    5 Star Lounger st3333ve's Avatar
    Join Date
    May 2003
    Location
    Los Angeles, California, USA
    Posts
    705
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Restart changes list template to outline (Word

    Thanks for the link. I vaguely recalled reading that all list templates were multi-level starting (I think) with Word 2002 and suspected the migration to Outline Numbering might not have any downsides, but for now I'm using a ListRestart macro that uses the gallery-referencing code if the style starts with "List Number" (and otherwise uses the Lockton code). So far so good, and it keeps my custom List Number styles Numbered (rather than Outline Numbered), just like the 5 built-in styles.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •