Re: VBA to Restart Numbering at a number other than 1
- From: Mark <Mark@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 13 May 2009 07:43:12 -0700
Thanks so much for your reply. Here are the details. Any further help you can
provide would be greatly appreciated.
Word2007
Note: I got rid of my Normal.dotm (so that Word would create a brand new one)
1 Created a new blank document and checked
activedocument.ListTemplates.Count. It is 0.
2 Clicked the Multi-level list dropdown and inserted a Numbering scheme
linked to the Heading styles. There was then 1 List template in the document.
3 Put in some Level 1 and Level 2 paragraphs
4 Placed my cursor on the last paragraph (a level 1 number)
5 Turned on Macro Recording.
6 Used the keyboard to bring up the right-click menu, and chose
Numbering-SetNumbering Value. I changed the Set Numbering Value to 10 and
clicked OK. When I queried, Activedocument.ListTemplates.Count remained 1
7 Turned off the Macro Recorder and got the macro listed below
I started again (repeating steps 1-4). I then ran the macro I had recorded.
The result was that the paragraph I was on started at 1 (not 10).
Sub RestartAt10
With ListGalleries(wdOutlineNumberGallery).ListTemplates(1).ListLevels(1)
.NumberFormat = "Article %1."
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleUppercaseRoman
.NumberPosition = InchesToPoints(0)
.Alignment = wdListLevelAlignLeft
.TextPosition = InchesToPoints(0)
.TabPosition = wdUndefined
.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 = "Heading 1"
End With
With ListGalleries(wdOutlineNumberGallery).ListTemplates(1).ListLevels(2)
.NumberFormat = "Section %1.%2"
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleLegalLZ
.NumberPosition = InchesToPoints(0)
.Alignment = wdListLevelAlignLeft
.TextPosition = InchesToPoints(0)
.TabPosition = wdUndefined
.ResetOnHigher = 1
.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 = "Heading 2"
End With
With ListGalleries(wdOutlineNumberGallery).ListTemplates(1).ListLevels(3)
.NumberFormat = "(%3)"
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleLowercaseLetter
.NumberPosition = InchesToPoints(0.2)
.Alignment = wdListLevelAlignLeft
.TextPosition = InchesToPoints(0.5)
.TabPosition = wdUndefined
.ResetOnHigher = 2
.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 = "Heading 3"
End With
With ListGalleries(wdOutlineNumberGallery).ListTemplates(1).ListLevels(4)
.NumberFormat = "(%4)"
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleLowercaseRoman
.NumberPosition = InchesToPoints(0.5)
.Alignment = wdListLevelAlignRight
.TextPosition = InchesToPoints(0.6)
.TabPosition = wdUndefined
.ResetOnHigher = 3
.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 = "Heading 4"
End With
With ListGalleries(wdOutlineNumberGallery).ListTemplates(1).ListLevels(5)
.NumberFormat = "%5)"
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleArabic
.NumberPosition = InchesToPoints(0.4)
.Alignment = wdListLevelAlignLeft
.TextPosition = InchesToPoints(0.7)
.TabPosition = wdUndefined
.ResetOnHigher = 4
.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 = "Heading 5"
End With
With ListGalleries(wdOutlineNumberGallery).ListTemplates(1).ListLevels(6)
.NumberFormat = "%6)"
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleLowercaseLetter
.NumberPosition = InchesToPoints(0.5)
.Alignment = wdListLevelAlignLeft
.TextPosition = InchesToPoints(0.8)
.TabPosition = wdUndefined
.ResetOnHigher = 5
.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 = "Heading 6"
End With
With ListGalleries(wdOutlineNumberGallery).ListTemplates(1).ListLevels(7)
.NumberFormat = "%7)"
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleLowercaseRoman
.NumberPosition = InchesToPoints(0.7)
.Alignment = wdListLevelAlignRight
.TextPosition = InchesToPoints(0.9)
.TabPosition = wdUndefined
.ResetOnHigher = 6
.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 = "Heading 7"
End With
With ListGalleries(wdOutlineNumberGallery).ListTemplates(1).ListLevels(8)
.NumberFormat = "%8."
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleLowercaseLetter
.NumberPosition = InchesToPoints(0.7)
.Alignment = wdListLevelAlignLeft
.TextPosition = InchesToPoints(1)
.TabPosition = wdUndefined
.ResetOnHigher = 7
.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 = "Heading 8"
End With
With ListGalleries(wdOutlineNumberGallery).ListTemplates(1).ListLevels(9)
.NumberFormat = "%9."
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleLowercaseRoman
.NumberPosition = InchesToPoints(1)
.Alignment = wdListLevelAlignRight
.TextPosition = InchesToPoints(1.1)
.TabPosition = wdUndefined
.ResetOnHigher = 8
.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 = "Heading 9"
End With
ListGalleries(wdOutlineNumberGallery).ListTemplates(1).Name = ""
Selection.Range.ListFormat.ApplyListTemplateWithLevel ListTemplate:= _
ListGalleries(wdOutlineNumberGallery).ListTemplates(1), _
ContinuePreviousList:=False, ApplyTo:=wdListApplyToWholeList, _
DefaultListBehavior:=wdWord10ListBehavior
End Sub
"Cindy M." wrote:
Hi Mark,.
In the macro code that is generated, I see nothing that indicates I am
starting at 10. If I manually edit the code and change "Start At" to 10, it
changes the first paragraph to 10, and the paragraph where the cursor is
located to 1.
Have you checked at this point whether one (or more) new list template(s) have
been generated in the document?
Which version of Word are you using? And what are the steps you use in the UI
to change the number of the paragraph? Are you certain that that, too, does
not generate at least one new List Template?
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)
- Follow-Ups:
- Re: VBA to Restart Numbering at a number other than 1
- From: Cindy M .
- Re: VBA to Restart Numbering at a number other than 1
- References:
- VBA to Restart Numbering at a number other than 1
- From: Mark
- Re: VBA to Restart Numbering at a number other than 1
- From: Cindy M .
- VBA to Restart Numbering at a number other than 1
- Prev by Date: Re: Programming Single Sided Printing
- Next by Date: Re: VBA macro stops executing on Word 2003 but works on Word XP
- Previous by thread: Re: VBA to Restart Numbering at a number other than 1
- Next by thread: Re: VBA to Restart Numbering at a number other than 1
- Index(es):
Relevant Pages
|