![]() |
|
#3
|
||||
|
||||
|
Hi Greg
I've had a look at your code and will throw in a bit of biased keyboard warrior opinion to add to the mix. I do have several macros like this that I've been using in templates for a very long time and can highly recommend them because lists have a well justified reputation for fragility. A macro like yours instantly fixes the style series should the list develop a problem. I am not a fan of adding new custom styles when there is already 250+ built-in style names which you can't get rid of especially when two series exist pretty much for this exact list type. For instance, I would prefer to use the 'List Multi' or 'List' series for a list like the one you are configuring. Using the built-in style name is cleaner (IMO), and you don't need extra code to check it exists. Although those built-in names only go up to 5, you could either add some custom ones for 6-9 or just not associate those lowest levels with a style (like I do). The chance of needing a list out to 6+ levels is pretty low so I normally leave the linked style blank for those ones. You can still apply the extra list levels by outline demote (Alt-Shift-Right Arrow) so having a paragraph style for it as well doesn't serve much usefulness. You asked about modifying the List Gallery - if you want to do that, you can avoid the clumsiness of the List style competely and cut out nearly all of the preamble... Code:
Dim oLT As ListTemplate Set oLT = ListGalleries(wdOutlineNumberGallery).ListTemplates(1) With oLT Code:
If oStyle.NameLocal Like m_strStyleLevelPrefixName & "*" Or oStyle.NameLocal = m_strListStyleName Then Code:
Sub CompileAllListTemplates()
Dim aLT As ListTemplate, i As Integer
For Each aLT In ListGalleries(wdOutlineNumberGallery).ListTemplates
Debug.Print aLT.Name, aLT.ListLevels(1).LinkedStyle
Next aLT
Debug.Print "=-=-=-=-=-=-=--"
For Each aLT In ActiveDocument.ListTemplates
If aLT.OutlineNumbered Then
'i = i + 1
'If aLT.Name = "" Then aLT.Name = "ListTemp" & i
Debug.Print aLT.Name, aLT.ListLevels(1).LinkedStyle
End If
Next aLT
''rename a list template
' ActiveDocument.ListTemplates("ListTemp19").Name = "Callout"
' ActiveDocument.ListTemplates("ListBullet").Name = "List Bullet"
End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Multi-level list Weirdness
|
jthomas666 | Word | 13 | 09-16-2019 12:40 PM |
Applied Styles to Headings in Multi-Level List; now ALL second level headings are 1.XX
|
NNL | Word | 1 | 08-09-2017 02:52 PM |
Multi-level list hell
|
Shevaun | Word | 5 | 06-19-2017 07:43 PM |
| How 2: Different Styles in Multi-Level List | BrianWren | Word | 1 | 10-21-2013 08:50 AM |
Headings + Multi-level list
|
falieson | Word | 1 | 06-18-2010 12:01 AM |