It seems that ListNum gives me all the functionality I want to number
procedural steps without Word arbitrarily changing them, and be able to
cross-reference them. But I don't like the ListNum format, which is number
(or letter) followed by a right parenthesis. I want to use periods, or use
periods for the first two levels and right parenthesis if it is ever
necessary to go to three levels (to be avoided if at all possible). It seems
I should be able to define my list (which I named "steps") with the format I
want, but the way to do that is not intuitively obvious to me. Anyone know
how to do this?
This my first foray into using macros and VBA, but it seems to be my only
hope if I don't want to continually be frustrated by Word.
Basically you define an outline-numbered list template and format it
the way you want, and give it a name. For safety, it's best to do this
by executing VBA statements (e.g. in the Immediate windows of the VBE)
but you *may* be OK doing it in the normal bulletws and numbering
dialog; I haven't tried.
Then, in each LISTNUM field, you include the name of the list template
and, if necessary, the level you want. See the online help for the
LISTNUM for details.
>
>This my first foray into using macros and VBA, but it seems to be my only
>hope if I don't want to continually be frustrated by Word.
That's right! Good luck.
--
John
Please reply to the newsgroup and not by e-mail. That way, more
brain cells get to work on the problem!
--
Suzanne S. Barnhill
Microsoft Word MVP
Words into Type
Fairhope, AL USA
John Nurick <j.nu...@dial.pipex.com> wrote in message
news:r3aidsc1c9r8cbpf8...@4ax.com...
>How would you name a list template other than through VBA? If there's a way
>through the B&N dialog, I would be interested in knowing it since I don't do
>VBA.
B&N | Outline Numbered | Customize | More | ListNum Field list name
From my *very* limited experimentation, this appears despite its
caption to name the ListTemplate and not the List itself (the List
object doesn't seem to expose a Name property to VBA). It's not
accessible through the non-outline numbered list gallery tabs.
There mayh be all sorts of ramifications of naming a listtemplate in
the listgallery (and hence in the registry). I've no idea how a
document using such a list might transfer to another computer with
different listgallery settings, but I'm sure someone else has tried
it.
--
Suzanne S. Barnhill
Microsoft Word MVP
Words into Type
Fairhope, AL USA
John Nurick <j.nu...@dial.pipex.com> wrote in message
news:a3fjds4hhisdmuejn...@4ax.com...
Having finished that little digression, I now have to admit how completely
clueless I am about how to use VBA. Any recommendations on a place to start?
I know what I want to try, but not how to execute it.
John Nurick <j.nu...@dial.pipex.com> wrote in message
>I tried defining a list template in the B&N dialogs and then using it, and
>it interfered with my heading numbering (changed the format and numbering of
>headings after the insertion point). Then I tried defining a specific list
>for headings and a separate one for steps and encountered the same problem.
>(Inserting LISTNUM fields directly into the document does not affect the
>heading numbering.) Having extensive background in sensible DTP programs
>such as Interleaf and FrameMaker, I expect that I should be able to have
>several separate numbered lists running through the document. Word seems to
>do that for table, figures, headings, but it doesn't seem to give the user
>the ability to do that, at least not through the standard dialogs. Is this
>correct? And does it let you do that if you use VBA?
Yes and no....
Word uses its old SEQ fields (dating from waaaay back when) for
numbering captions, and these are still the most reliable way of doing
most other kinds of numbering, though not the easiest. You can have
any number of diferent named sequences in your document, restarting
them as often as you like. If you search the archive of this group at
www.deja.com you will find (a) postings by John McGhie with
explanations of using SEQ fields for mult-level numbering and (b)
references to the Tech-Tav template which includes macros for
numbering with SEQ fields.
The system used by Word 97 onwards for numbered headings and numbered
and bulleted lists is an entirely separate system in which each list
is an object in its own right, based on a listtemplate. Each document
can have any number of listtemplates (hundreds, anyway).
Unfortunately, the team implementing it seems to have run out of time
and Word was released with the numbering system in what we can
charitably call an alpha state.
One of the things that definitely helps keep numbering stable is to
create a new listtemplate with the formattign you need, give it a
name, and link the relevant styles to the appropriate listlevels of
that template. This requires VBA. Possibly the named-listtemplate
approach can be used through the standard B&N dialog (as I suggested
elsewhere in this thread) but I wouldn't count on it.
>You've given me something to think about. I've been keeping my head down and
>my eyes blinkered in this NG as much as possible because beating numbering
>into submission seemed to be something that required VBA. I've had pretty
>good luck with some kinds of numbering (by persistent trial and error), but
>for outline numbering I usually give up and do it (the lower levels, at
>least) manually because I don't want to monkey with the List Gallery
>settings (which I've Reset) and possibly hose everything I've already done.
>One of these days, though, I'm going to have to buckle down and figure it
>out.
I recommend VBA. It's equally frustrating, but you achieve more along
the way!
Thanks for your explanations and comments. I've looked at some of the deja
postings and will keep working through them until it starts making sense.
Donna
John Nurick <j.nu...@dial.pipex.com> wrote in message
news:d9vkdsc4rma5t28gi...@4ax.com...
--
Suzanne S. Barnhill
Microsoft Word MVP
Words into Type
Fairhope, AL USA
Peltier <pel...@home.com> wrote in message
news:38DD6E32...@home.com...
> To the group and experts:
>
> Has anyone taken the steps to do this in VBA and systematized the
> process? Like in a web page that can step us through it? I use lots of
> VBA in Excel, and in a recent exercise had a load of numbering in a long
> document, which once or twice crashed. I ended up bolting together a
> rough manual approach with the SEQ fields, which worked pretty well, but
> I'd like to use the built in styles more effectively.
>
> I have gone to the various pasta-related postings referred to in this
> thread, but they don't start in one place and walk through the process.
> Rather they address different aspects piecewise, and I have not been
> able to make a lot of sense of them.
>
> If anyone could point me to a good site, I'd be very thankful.
>
> - Jon
> _______
"Suzanne S. Barnhill" wrote:
>
> It may have been an early take that has since been amended, but if you'll
> search Deja for Margaret Aldis's "Firmly linking list formats to styles
> (long)" (there's a second version with the same subject line with "Reprise"
> added), you might find that more systematic.
>
> --
> Suzanne S. Barnhill
> Microsoft Word MVP
> Words into Type
> Fairhope, AL USA
>
> Peltier <pel...@home.com> wrote in message
> news:38DD6E32...@home.com...
IIRC, the main development since I documented this approach to numbered
styles was the input from John Nurick and Bill Coan on naming the list
template (as opposed to simply adding it to bypass the List Gallery).
This avoids building up extra List Templates if you run the code more
than once. John, Dave Rado and I are all now using this method in
'production' environments and are convinced it prevents the style-list
level links from breaking when you cut and paste between documents or
update styles from the template. Dave Rado has posted sample code
recently, and I would suggest that is the best pattern to use.
The only caveat I have to add (this is new News, not previously posted!)
is that I think I now have repeatable evidence that the style-list level
links become frangible again if you copy the styles with the organiser
between templates. A document created from a template created in this
way works OK when used in the 'normal' way, but when you update styles
from the template some odd things still happen - so always run your
'list set up' code in every template (or make one template from another)
if you are trying to maintain a consistent set.
For normal hierarchical headings, Word 97 SR2 introduced some fixes to
the various problems that 'split up' the continuity of the numbering,
and many people are now happy using the standard facilities provided for
numbered built-in heading styles, and don't use the VBA set up. I
believe that the links do still break sometimes when updating from
template, however. Posts by John McGhie suggest some extra precautions
about setting up the List Gallery which may address this - I can't add
anything further here.
For numbered lists, there is a fundamental problem with the 'paradigm'
surrounding when and how to restart the numbering. Some people have
tried macros for restarting the list using the named List Template, but
the fundamental 'classic spaghetti numbering' problem, (that cutting and
pasting items between lists may entwine the 'List Objects') still exists
in this case. Also any list item that has been 'restarted' (and the
following list items if created by carriage return after it) will have
the numbering applied as 'direct formatting' - so any cleaning 'back to
style' will lose the restart.
For these reasons, many people still use SEQ fields for numbered lists -
the code for doing this has been posted several times by John McGhie. I
went down a different route and use the top level of an outline list as
a 'dummy' to mark the start of a numbered list. Dave Rado has
reluctantly followed me there. This keeps all the numbering coming from
style, but leaves you with the 'yuk' factor of small, white paragraphs
in your document. You also need to write code to add the dummy when the
user wishes to start a list, and remove it again if required.
HTH
Margaret
In article <#I9DHxsl$GA.176@cppssbbsa05>, Suzanne S. Barnhill
<sbar...@zebra.net> writes
--
Margaret Aldis, Syntagma, e-mail Margare...@syntagma.co.uk
"Civilisation advances by extending the number of important
operations which we can perform without thinking about them.
Operations of thought are like cavalry charges in battle - they are
strictly limited in number, they require fresh horses, and must
only be made at decisive moments." A N Whitehead
To add to Margaret's comments:-
1) I've found that using named list templates not only avoids building up
redundant list templates but also seems to me to make the properties more
stable, especially when updating styles using the organiser. (Although in
this context, as Margaret says, it's probably safest to run your "define
list styles" code in any new templates you create rather than using the
organiser to copy list styles between templates).
2) Sample code for defining a list template for heading styles can be found
in the thread "Relinking list templates" started by Valerie Milton.
3) Sample code for defining a non-outlined bulleted style can be found in
the recent "many, many different types of "bullets"" thread.
4) There really are only two stable ways of defining outline numbered lists
(not including heading numbering), given the restart numbering issue - using
SEQ fields or Margaret's dummy style solution, which I now use as well.
5) Sample code defining the styles for an outline numbered list
incorporating a dummy list level 1 style to restart numbering is given
below. The code for an outline level list bullet style set is similar but
without the need for a dummy style.
5) For both numbered and bulleted lists I've found it necessary to define
separate style sets with their own list templates for use in body text and
for use in tables (borderless tables counting as body text in this
context) - because of the different paragraph spacing requirements in
tables. I did try linking two style sets to one list template but I found
that it didn't work satisfactorily.
6) If users use the list galleries rather than your styles, expect trouble -
including documents crashing in some circumstances (see "Problems with
outline bullet template instability" thread). John and I have replaced
Format Bullets and Numbering with our own macro, which displays a userform
that includes a More button, with a warning if you click on "More" that the
user is on their own if they continue! I think Margaret plans to do
something similar. John and Margaret have removed the FormatNumberDefault
and FormatBulletDefault buttons, and train their users to apply styles, anf
they have "Remove Numbering" and "Restart Numbering" buttons; whereas I
have replaced both buttons identical looking ones that apply/remove styles
as appropriate, and also add/remove the dummy list level 1 paragraphs when
appropriate. My approach requires a lot more coding. Anyway the point is
that it's a good idea to get rid of all built in buttons that apply bullets
or numbering as direct formatting - or at least make them hard to get at.
6) I use the built-in List Number styles, but avoid using the built-in List
Bullet styles, because the latter have "Automatally Update" as part of their
style definitions, and even if you switch this setting off, it tends to
magically reappear like a bad penny and wave at you cheerfully when you copy
the styles using the Organiser. "Automatally Update" is a horrible setting,
(especially horrible for bullet styles, because as soon as you try to indent
a bullet, the style is redefined!!!) so I've created my own Bullet styles
rather than redefining the built-in ones.
Regards
Dave
_________________________
Sub SetupListNumbering()
Dim oLstTemplate As ListTemplate, TemplateFound As Boolean
'----------------------------------------------------------------
ActiveDocument.Styles.Add Name:="List Number", Type:=wdStyleTypeParagraph
With ActiveDocument.Styles("List Number")
.AutomaticallyUpdate = False
.BaseStyle = "Normal"
.ParagraphFormat.SpaceAfter = 8
End With
ActiveDocument.Styles.Add Name:="List Number 0", Type:=wdStyleTypeParagraph
With ActiveDocument.Styles("List Number 0")
.AutomaticallyUpdate = False
.BaseStyle = "Normal"
.NextParagraphStyle = "List Number"
With .ParagraphFormat
.SpaceAfter = 0
.LineSpacingRule = wdLineSpaceSingle
End With
.Font.Size = 1
End With
ActiveDocument.Styles.Add Name:="List Number 2", Type:=wdStyleTypeParagraph
With ActiveDocument.Styles("List Number 2")
.AutomaticallyUpdate = False
.BaseStyle = "List Number"
.ParagraphFormat.SpaceAfter = 6
End With
ActiveDocument.Styles.Add Name:="List Number 3", Type:=wdStyleTypeParagraph
With ActiveDocument.Styles("List Number 3")
.AutomaticallyUpdate = False
.BaseStyle = "List Number 2"
.ParagraphFormat.SpaceAfter = 4
End With
ActiveDocument.Styles.Add Name:="List Number 4", Type:=wdStyleTypeParagraph
With ActiveDocument.Styles("List Number 4")
.AutomaticallyUpdate = False
.BaseStyle = "List Number 3"
.ParagraphFormat.SpaceAfter = 4
End With
'----------------------------------------------------------------
'----------------------------------------------------------------
For Each oLstTemplate In ActiveDocument.ListTemplates
If oLstTemplate.Name = "NumberListTemplate" Then
TemplateFound = True
Exit For
End If
Next oLstTemplate
'----------------------------------------------------------------
If TemplateFound Then
Set oLstTemplate = ActiveDocument.ListTemplates("NumberListTemplate")
Else
Set oLstTemplate =
ActiveDocument.ListTemplates.Add(OutlineNumbered:=True)
oLstTemplate.Name = "NumberListTemplate"
End If
'----------------------------------------------------------------
'----------------------------------------------------------------
With oLstTemplate.ListLevels(1)
.NumberFormat = ""
.TrailingCharacter = wdTrailingNone
.NumberStyle = wdListNumberStyleLegal
.NumberPosition = InchesToPoints(0)
.Alignment = wdListLevelAlignLeft
.TextPosition = InchesToPoints(0.3)
.TabPosition = wdUndefined
.ResetOnHigher = True
.StartAt = 1
.LinkedStyle = "List Number 0"
End With
With oLstTemplate.ListLevels(2)
.NumberFormat = "%2."
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleArabic
.NumberPosition = InchesToPoints(0)
.Alignment = wdListLevelAlignLeft
.TextPosition = InchesToPoints(0.3)
.TabPosition = wdUndefined
.ResetOnHigher = True
.StartAt = 1
With .Font
.Bold = True
End With
.LinkedStyle = "List Number"
End With
With oLstTemplate.ListLevels(3)
.NumberFormat = "%2.%3."
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleArabic
.NumberPosition = InchesToPoints(0.3)
.Alignment = wdListLevelAlignLeft
.TextPosition = InchesToPoints(0.75)
.TabPosition = wdUndefined
.ResetOnHigher = True
.StartAt = 1
With .Font
.Bold = True
End With
.LinkedStyle = "List Number 2"
End With
With oLstTemplate.ListLevels(4)
.NumberFormat = "%2.%3.%4."
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleLegal
.NumberPosition = InchesToPoints(0.75)
.Alignment = wdListLevelAlignLeft
.TextPosition = InchesToPoints(1.4)
.TabPosition = wdUndefined
.ResetOnHigher = True
.StartAt = 1
With .Font
.Bold = True
End With
.LinkedStyle = "List Number 3"
End With
With oLstTemplate.ListLevels(5)
.NumberFormat = ""
.TrailingCharacter = wdTrailingNone
.NumberStyle = wdListNumberStyleNone
.NumberPosition = InchesToPoints(1.4)
.Alignment = wdListLevelAlignLeft
.TextPosition = InchesToPoints(1.4)
.TabPosition = wdUndefined
.ResetOnHigher = True
.StartAt = 1
.LinkedStyle = "List Number 4"
End With
End Sub
Thanks so much for your responses and help--especially for the code sample,
Dave, and the description of "spaghetti numbering," Margaret. That explained
a lot. I just customized the code sample for my needs and ran it, and so far
everything seems to work fine. I still have to do the macros for adding and
removing the dummy, and figure out how to change buttons, etc. But at least
I can now meet my deadline using something that behaves reasonably. Thank
you!!
Donna
Dave Rado <dave...@contactbox.co.uk> wrote in message
news:um8muR3l$GA....@cppssbbsa02.microsoft.com...
Dave
Larry <larr...@att.net> wrote in message
news:#KgxU0Xn$GA.1324@cppssbbsa06...