Linking ListTemplates to paragraph styles

R

Rcih007

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
 
S

Stefan Blom

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.
 
R

Rich007

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
 
J

Jeff Jansen

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
 
S

Stefan Blom

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top