Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 05-06-2024, 04:43 AM
Guessed's Avatar
Guessed Guessed is offline Multi-Level List on the Fly Windows 10 Multi-Level List on the Fly Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,185
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
[[Relevant only if you ignore my above rant on custom styles]] It might be easy to trip people by giving them a chance to edit the list prefix constant (without telling them it had to be three characters). Your cleanup macro is looking for a three character prefix only. Perhaps rewrite that line to allow for any matching prefix
Code:
If oStyle.NameLocal Like m_strStyleLevelPrefixName & "*" Or oStyle.NameLocal = m_strListStyleName Then
And here is a little bit of code in case you wanted to audit what list templates are already in your document.
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
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multi-Level List on the Fly Multi-level list Weirdness jthomas666 Word 13 09-16-2019 12:40 PM
Multi-Level List on the Fly 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 on the Fly 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
Multi-Level List on the Fly Headings + Multi-level list falieson Word 1 06-18-2010 12:01 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:42 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft