From: Jeff Jansen Jeff on
Rich,

Did you ever get this to work? I used your method 1 but the statement:

Set ltTemp = ActiveDocument.ListTemplates("MyNewListTemplate")

where my version of "MyNewListTemplate" DOES exist, generates a run-time
error saying "The requested member of the collection does not exist." In
fact, when I wrote a test macro to simply display the Names of every
ListTemplate, NO Names were displayed. Did you figure out how to return a
ListTemplate object by name, or even how to determine the index of a named
ListTemplate?

TIA,
Jeff Jansen
Portland, OR

"Rich007" wrote:

> Many thanks for the advice Stefan.
> In that case, since it appears to be the easiest one to work with, I'll go
> with (2):
>
> ActiveDocument.ListTemplates("MyNewListTemplate").ListLevels(1).LinkedStyle
> = "MyNewStyle"
>
> If anyone else finds a reason to do otherwise, (e.g. any advantage or
> disadvantage of linking in both directions) please post here.
>
> Thanks again
> Cheers
> Rich
>
> "Stefan Blom" wrote:
>
> > Modifying the list galleries, which (3) does, is not recommended (as far as
> > I know).
> >
> > It makes more sense to work with list templates and styles directly. How you
> > do that, that is if you make use of (1) or (2), shouldn't matter.
> >
> > --
> > Stefan Blom
> > Microsoft Word MVP
> >
> >
> >
> > "Rcih007" <Rich007(a)discussions.microsoft.com> wrote in message
> > news:A411BF79-D4E6-4764-AE5E-7A2D6A59AE10(a)microsoft.com...
> > >I have read much of the advice on all the forums and MVP sites about how to
> > > create styles with outline numbering using a named ListTemplate, and the
> > > importance of linking the style to the ListTemplate and/or vice versa.
> > > What
> > > I can't understand is which of the following I should be using:
> > >
> > > (where MyNewStyle is a paragraph style and MyNewListTemplate is a
> > > ListTemplate)
> > >
> > > 1)
> > > Dim ltTemp As ListTemplate
> > > Set ltTemp = ActiveDocument.ListTemplates("MyNewListTemplate")
> > > ActiveDocument.Styles("MyNewStyle").LinkToListTemplate
> > > ListTemplate:=ltTemp
> > >
> > > 2)
> > > ActiveDocument.ListTemplates("MyNewListTemplate").ListLevels(1).LinkedStyle
> > > = "MyNewStyle"
> > >
> > > 3)
> > > ListGalleries(wdOutlineNumberGallery).ListTemplates(7).ListLevels(1).LinkedStyle
> > > = "MyNewStyle"
> > >
> > > Can anyone explain the difference, and which one(s) I should use?
> > >
> > > Is it a good or bad thing to use both 1 AND 2; linking in both directions
> > > so
> > > that my paragraph style is linked to my ListTemplate (1) and my
> > > ListTemplate
> > > is liked to my style (2)?
> > >
> > > Is there any merit in assigning a ListGallery to a paragraph style, or
> > > even
> > > a ListTemplate to a ListGallery. (My initial attempts with this, using
> > > either 1 or 2 or both, but not 3, appear to gradually fill up the
> > > Galleries
> > > with my outline numbering each time I redefine the styles).
> > >
> > > Any advice gratefully received.
> > > Cheers
> > > Rich

From: Stefan Blom on
Did you remember to name your list templates as you created them? In
particular, note that list style names and list template names are *not* the
same thing.

--
Stefan Blom
Microsoft Word MVP



"Jeff Jansen" <Jeff Jansen(a)discussions.microsoft.com> wrote in message
news:12C9438F-DD3C-4FE5-8C27-E84A75917EEA(a)microsoft.com...
> Rich,
>
> Did you ever get this to work? I used your method 1 but the statement:
>
> Set ltTemp = ActiveDocument.ListTemplates("MyNewListTemplate")
>
> where my version of "MyNewListTemplate" DOES exist, generates a run-time
> error saying "The requested member of the collection does not exist." In
> fact, when I wrote a test macro to simply display the Names of every
> ListTemplate, NO Names were displayed. Did you figure out how to return a
> ListTemplate object by name, or even how to determine the index of a named
> ListTemplate?
>
> TIA,
> Jeff Jansen
> Portland, OR
>
> "Rich007" wrote:
>
>> Many thanks for the advice Stefan.
>> In that case, since it appears to be the easiest one to work with, I'll
>> go
>> with (2):
>>
>> ActiveDocument.ListTemplates("MyNewListTemplate").ListLevels(1).LinkedStyle
>> = "MyNewStyle"
>>
>> If anyone else finds a reason to do otherwise, (e.g. any advantage or
>> disadvantage of linking in both directions) please post here.
>>
>> Thanks again
>> Cheers
>> Rich
>>
>> "Stefan Blom" wrote:
>>
>> > Modifying the list galleries, which (3) does, is not recommended (as
>> > far as
>> > I know).
>> >
>> > It makes more sense to work with list templates and styles directly.
>> > How you
>> > do that, that is if you make use of (1) or (2), shouldn't matter.
>> >
>> > --
>> > Stefan Blom
>> > Microsoft Word MVP
>> >
>> >
>> >
>> > "Rcih007" <Rich007(a)discussions.microsoft.com> wrote in message
>> > news:A411BF79-D4E6-4764-AE5E-7A2D6A59AE10(a)microsoft.com...
>> > >I have read much of the advice on all the forums and MVP sites about
>> > >how to
>> > > create styles with outline numbering using a named ListTemplate, and
>> > > the
>> > > importance of linking the style to the ListTemplate and/or vice
>> > > versa.
>> > > What
>> > > I can't understand is which of the following I should be using:
>> > >
>> > > (where MyNewStyle is a paragraph style and MyNewListTemplate is a
>> > > ListTemplate)
>> > >
>> > > 1)
>> > > Dim ltTemp As ListTemplate
>> > > Set ltTemp = ActiveDocument.ListTemplates("MyNewListTemplate")
>> > > ActiveDocument.Styles("MyNewStyle").LinkToListTemplate
>> > > ListTemplate:=ltTemp
>> > >
>> > > 2)
>> > > ActiveDocument.ListTemplates("MyNewListTemplate").ListLevels(1).LinkedStyle
>> > > = "MyNewStyle"
>> > >
>> > > 3)
>> > > ListGalleries(wdOutlineNumberGallery).ListTemplates(7).ListLevels(1).LinkedStyle
>> > > = "MyNewStyle"
>> > >
>> > > Can anyone explain the difference, and which one(s) I should use?
>> > >
>> > > Is it a good or bad thing to use both 1 AND 2; linking in both
>> > > directions
>> > > so
>> > > that my paragraph style is linked to my ListTemplate (1) and my
>> > > ListTemplate
>> > > is liked to my style (2)?
>> > >
>> > > Is there any merit in assigning a ListGallery to a paragraph style,
>> > > or
>> > > even
>> > > a ListTemplate to a ListGallery. (My initial attempts with this,
>> > > using
>> > > either 1 or 2 or both, but not 3, appear to gradually fill up the
>> > > Galleries
>> > > with my outline numbering each time I redefine the styles).
>> > >
>> > > Any advice gratefully received.
>> > > Cheers
>> > > Rich
>