RESTART Numbering by STYLE

T

Tim

I receive documents that have a styled called "NUMB" which contains a
numbered list using this style on the first page. Each subsequent page
starts a new section and has a paragraph tagged w/ NUMB.

By default, the NUMB paragraphs pick up the numbering from the preceding
style, as in:

Pg 1:
1. Red
2. Yellow
3. Green

Pg 2:
4. Magenta
5. Cyan
6. Yellow

Pg. 3:
7. Apples
8. Oranges
9. Grapefruit

Silly examples, but that's the general idea.

What I need is for the numbering tro restart on each page as below. Can't
figure out any paragraph attribute that will do this, but perhaps there's a
macro that can be run on the completed doc to reset the numbering to "1" for
the beginning of all paragraphs with the NUMB style?

Pg 1:
1. Red
2. Yellow
3. Green

Pg 2:
1. Magenta
2. Cyan
3. Yellow

Pg. 3:
1. Apples
2. Oranges
3. Grapefruit
 
W

Word Heretic

G'day "Tim" <[email protected]>,



Public Sub TimsSimpleRestarter()
'$Author The Word Heretic, (e-mail address removed)
Const RestartStyle As String = "CHANGE ME"
Const NumberStyle As String = "NUMB"

Dim Para As Paragraph
Dim Restart As Boolean

Restart = False
For Each Para In ActiveDocument.Paragraphs
If Restart And Para.Style = NumberStyle Then

'the restart hoodoo guru

With Para.Range.ListFormat
.ApplyListTemplate .ListTemplate, False
End With
Restart = False

ElseIf Not Restart Then
Restart = (Para.Style = RestartStyle)
End If
Next
Set Para=Nothing
End Sub


Tim said:
I receive documents that have a styled called "NUMB" which contains a
numbered list using this style on the first page. Each subsequent page
starts a new section and has a paragraph tagged w/ NUMB.

By default, the NUMB paragraphs pick up the numbering from the preceding
style, as in:

Pg 1:
1. Red
2. Yellow
3. Green

Pg 2:
4. Magenta
5. Cyan
6. Yellow

Pg. 3:
7. Apples
8. Oranges
9. Grapefruit

Silly examples, but that's the general idea.

What I need is for the numbering tro restart on each page as below. Can't
figure out any paragraph attribute that will do this, but perhaps there's a
macro that can be run on the completed doc to reset the numbering to "1" for
the beginning of all paragraphs with the NUMB style?

Pg 1:
1. Red
2. Yellow
3. Green

Pg 2:
1. Magenta
2. Cyan
3. Yellow

Pg. 3:
1. Apples
2. Oranges
3. Grapefruit

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email: (e-mail address removed)
Products: http://www.geocities.com/word_heretic/products.html
Spellbooks: 728 pages of dump left and dropping...

The VBA Beginner's Spellbook: For all VBA users.
 
T

Tim

Thanks much, Steve-- but I must be missing something as I can't get this to
work. That is, each paragraph w/ the style NUMB still picks up the numbering
from the previous NUMB styled paragraph. (??)
 
T

Tim

Steve: I also neglected to mention that these NUMB styled paragraphs are in
a separate table on each page-- if that makes any difference?
 
T

Tim

Excellent-- that worked.

Thanks again!



Word Heretic said:
G'day "Tim" <[email protected]>,

Change CHANGE ME to the style name you will insert between lists to
mark the restart point as per your specification.





Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email: (e-mail address removed)
Products: http://www.geocities.com/word_heretic/products.html
Spellbooks: 728 pages of dump left and dropping...

The VBA Beginner's Spellbook: For all VBA users.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top