C
Chuck Martin
OK, I've been struggling with this for a couple of days now with zero
success. I have a document in Word 2003 with SP1 applied. The list
numbering--writing docs for software, naturally I'm creating lots of
procedures--is wonky in the extreme.
I know I created a little macro kludge a few years back that actually
worked, but I'll be d@mned if I can find the doc on any of my computers
(so far, still with one more to search). I'm pretty sure Iposted that
solution on a list too, but searching hasn't turned up that post.
I've found links in searches to many posts, some on the MVP site with
various VBA "solutions." Trouble is, none of them have worked.
At one point, I would open the VBA editor, copy in the entire Public Sub
RestartListNumbering(Optional Scope As Range) macro, close the editor,
got to Tools>Macros, and find that RestartListNumbering was not in the
macro list. In any list, in the document, in the template, anywhere.
(Last night, I closed Word. This morning, I started it up again. It's
not in the macro list. Go figure. But it still doesn't work.)
The "solution" at shaunakelly.com doesn't seem to apply because it's
about ouline numbering.
I'v seen several posts about naming list templates. One pointed me to a
thread with the following:
"always use *named* list templates - in the Bullets and Numbering dialog
make sure to click the More button and type a name in the "ListNum field
list name" field - but again only do this via
Format>Style>Modify>Format>Numbering; by using a named list template if
there are problems you can check to make sure your numbering is attached
correctly (by making sure the ListNum field list name matches the name
of your list template)."
Well, besides the issue of there is no longer a "Style" command in the
"Format" menu, when I do try to format the style, get to
Modify>Format>Numbering, I find no "More" button and nowhere on any tab
or dialog box a ListNum field or anything else that looks like a name
for the list template.
If I remember correctly, the old macro kludge that I put together
involved the following steps of psuedocode:
1. Put cursor at beginning of first step.
2. Press Enter to get a new paragraph above.
3. Move cursor up to empty paragraph.
4. Apply restart Numbering command. This would restart numbering with
the *next* step (the one I want it to).
5. Delete the empty paragraph.
I was deleriously happy at the time.
But now, first of all, when I try to do all this manually and I move the
cursor into the empty paragraph and apply RestartNumbering (and I can do
this only with the right-click pop-up menu), it doesn't restart the next
item like it once did. But if I put a few characters of text in and then
apply the command, it *does* restart the next item. Even more weird.
I was able to eventually capture all this behavior in a recorded macro:
Sub fixNumbering()
'
' fixNumbering Macro
' Macro recorded 11/14/2005 by Chuck Martin
'
Selection.TypeParagraph
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.TypeText Text:="temp"
With ListGalleries(wdNumberGallery).ListTemplates(1).ListLevels(1)
.NumberFormat = "%1."
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleArabic
.NumberPosition = InchesToPoints(0.75)
.Alignment = wdListLevelAlignLeft
.TextPosition = InchesToPoints(1)
.TabPosition = InchesToPoints(1)
.ResetOnHigher = 0
.StartAt = 1
With .Font
.Bold = wdUndefined
.Italic = wdUndefined
.StrikeThrough = wdUndefined
.Subscript = wdUndefined
.Superscript = wdUndefined
.Shadow = wdUndefined
.Outline = wdUndefined
.Emboss = wdUndefined
.Engrave = wdUndefined
.AllCaps = wdUndefined
.Hidden = wdUndefined
.Underline = wdUndefined
.Color = wdUndefined
.Size = wdUndefined
.Animation = wdUndefined
.DoubleStrikeThrough = wdUndefined
.Name = ""
End With
.LinkedStyle = "List Number"
End With
ListGalleries(wdNumberGallery).ListTemplates(1).Name = ""
Selection.Range.ListFormat.ApplyListTemplate
ListTemplate:=ListGalleries( _
wdNumberGallery).ListTemplates(1), ContinuePreviousList:=False,
ApplyTo:= _
wdListApplyToWholeList, DefaultListBehavior:=wdWord10ListBehavior
Selection.HomeKey Unit:=wdLine
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
End Sub
Now I;ve not taken the time to cull out the uneccesary lines in th With
blocks. But here's the deal. When I do this all manually, it works. When
I run this macro, it doesn't work.
I'm at a loss.
I don't know if i'll help, but at one point a tried to record a macro
with the Name RestartNumbering, and then, down deep in the bowels of the
list of all commands, I found that there does indeed seem to be a
RestartNumbering built-in command, although I can find no reference to
it whatsoever in the VBA Editor's help system. Whether my trying to
record actions for this messed up the built-in command I can't say.
But I've been spending a lot of time on this and I've not found a
solution that works for me. I would appreciate any help that I can get.
thx,
Chuck Martin
success. I have a document in Word 2003 with SP1 applied. The list
numbering--writing docs for software, naturally I'm creating lots of
procedures--is wonky in the extreme.
I know I created a little macro kludge a few years back that actually
worked, but I'll be d@mned if I can find the doc on any of my computers
(so far, still with one more to search). I'm pretty sure Iposted that
solution on a list too, but searching hasn't turned up that post.
I've found links in searches to many posts, some on the MVP site with
various VBA "solutions." Trouble is, none of them have worked.
At one point, I would open the VBA editor, copy in the entire Public Sub
RestartListNumbering(Optional Scope As Range) macro, close the editor,
got to Tools>Macros, and find that RestartListNumbering was not in the
macro list. In any list, in the document, in the template, anywhere.
(Last night, I closed Word. This morning, I started it up again. It's
not in the macro list. Go figure. But it still doesn't work.)
The "solution" at shaunakelly.com doesn't seem to apply because it's
about ouline numbering.
I'v seen several posts about naming list templates. One pointed me to a
thread with the following:
"always use *named* list templates - in the Bullets and Numbering dialog
make sure to click the More button and type a name in the "ListNum field
list name" field - but again only do this via
Format>Style>Modify>Format>Numbering; by using a named list template if
there are problems you can check to make sure your numbering is attached
correctly (by making sure the ListNum field list name matches the name
of your list template)."
Well, besides the issue of there is no longer a "Style" command in the
"Format" menu, when I do try to format the style, get to
Modify>Format>Numbering, I find no "More" button and nowhere on any tab
or dialog box a ListNum field or anything else that looks like a name
for the list template.
If I remember correctly, the old macro kludge that I put together
involved the following steps of psuedocode:
1. Put cursor at beginning of first step.
2. Press Enter to get a new paragraph above.
3. Move cursor up to empty paragraph.
4. Apply restart Numbering command. This would restart numbering with
the *next* step (the one I want it to).
5. Delete the empty paragraph.
I was deleriously happy at the time.
But now, first of all, when I try to do all this manually and I move the
cursor into the empty paragraph and apply RestartNumbering (and I can do
this only with the right-click pop-up menu), it doesn't restart the next
item like it once did. But if I put a few characters of text in and then
apply the command, it *does* restart the next item. Even more weird.
I was able to eventually capture all this behavior in a recorded macro:
Sub fixNumbering()
'
' fixNumbering Macro
' Macro recorded 11/14/2005 by Chuck Martin
'
Selection.TypeParagraph
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.TypeText Text:="temp"
With ListGalleries(wdNumberGallery).ListTemplates(1).ListLevels(1)
.NumberFormat = "%1."
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleArabic
.NumberPosition = InchesToPoints(0.75)
.Alignment = wdListLevelAlignLeft
.TextPosition = InchesToPoints(1)
.TabPosition = InchesToPoints(1)
.ResetOnHigher = 0
.StartAt = 1
With .Font
.Bold = wdUndefined
.Italic = wdUndefined
.StrikeThrough = wdUndefined
.Subscript = wdUndefined
.Superscript = wdUndefined
.Shadow = wdUndefined
.Outline = wdUndefined
.Emboss = wdUndefined
.Engrave = wdUndefined
.AllCaps = wdUndefined
.Hidden = wdUndefined
.Underline = wdUndefined
.Color = wdUndefined
.Size = wdUndefined
.Animation = wdUndefined
.DoubleStrikeThrough = wdUndefined
.Name = ""
End With
.LinkedStyle = "List Number"
End With
ListGalleries(wdNumberGallery).ListTemplates(1).Name = ""
Selection.Range.ListFormat.ApplyListTemplate
ListTemplate:=ListGalleries( _
wdNumberGallery).ListTemplates(1), ContinuePreviousList:=False,
ApplyTo:= _
wdListApplyToWholeList, DefaultListBehavior:=wdWord10ListBehavior
Selection.HomeKey Unit:=wdLine
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
End Sub
Now I;ve not taken the time to cull out the uneccesary lines in th With
blocks. But here's the deal. When I do this all manually, it works. When
I run this macro, it doesn't work.
I'm at a loss.
I don't know if i'll help, but at one point a tried to record a macro
with the Name RestartNumbering, and then, down deep in the bowels of the
list of all commands, I found that there does indeed seem to be a
RestartNumbering built-in command, although I can find no reference to
it whatsoever in the VBA Editor's help system. Whether my trying to
record actions for this messed up the built-in command I can't say.
But I've been spending a lot of time on this and I've not found a
solution that works for me. I would appreciate any help that I can get.
thx,
Chuck Martin