===================================
In order to do thing 1:
1. bla bla bla
2. ble ble ble
3. blo blo blo
In order to do thing 2:
4. bla bla bla
5. ble ble ble
6. blo blo blo
In order to do thing 3:
7. bla bla bla
8. ble ble ble
9. blo blo blo
==================================
But actually they should look like:
=================================
In order to do thing 1:
1. bla bla bla
2. ble ble ble
3. blo blo blo
In order to do thing 2:
1. bla bla bla
2. ble ble ble
3. blo blo blo
In order to do thing 3:
1. bla bla bla
2. ble ble ble
3. blo blo blo
=====================================
In other words, the list should have restarted but they did not.
Could anybody let me know how I fix this problem by writng piece of
VBA codes? Oh yes, all the listed items have a style 'list number'
in my document.
Thanks in advance,
Tony
If your 'In order to' paragraphs all use the same style (say, Body Text)
then the best way to automate this is probably to redefine your
numbering so that the number on List Number restarts after a Body Text
paragraph. Better still would be if these lists each occur with their
own section (Thing 1, Thing 2 etc.) - in that case you can use the
heading hierarchy to pull the same trick.
For information about setting up outline numbering schemes see Shauna
Kelly's instructions at:
http://www.ShaunaKelly.com/word/numbering/OutlineNumbering.html
If you can't use this an existing style to force the restart, then you
have two other possibilities:
You can introduce a dummy style (formatted small and white so as not to
interfere with the print) to do the same job, and add a paragraph in
that style before each list.
You can use VBA to restart numbering on the first item in the list.
Steve Hudson's code for this is:
Public Sub RestartListNumbering()
'her...@tdfa.com
Dim TheRange As Range
Set TheRange = Selection.Range
TheRange.Collapse
On Error Resume Next
With TheRange.ListFormat
.ApplyListTemplate .ListTemplate, False
End With
End Sub
The disadvantage of this over the style method is that you are applying
direct formatting to the paragraph, so if you reset to style at some
point in the future the numbering will (quite correctly) return to
continuous.
However, your main challenge in either case is likely to be identifying
the first list item programmatically.
Hope this helps
Margaret
In article <#vpvfP7B...@TK2MSFTNGP11.phx.gbl>, Tony Dai
<asia...@sina.com> 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
--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://www.mvps.org/word
"Tony Dai" <asia...@sina.com> wrote in message
news:#vpvfP7B...@TK2MSFTNGP11.phx.gbl...
Margaret
In article <eVVISeAC...@TK2MSFTNGP11.phx.gbl>, Suzanne S. Barnhill
<sbar...@mvps.org> writes
--
--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://www.mvps.org/word
"Margaret Aldis" <margare...@nospam.demon.co.uk> wrote in message
news:fI6dhiK+1$o+I...@syntagma.demon.co.uk...
I'd probably select the entire document and convert all the numbering
to manually formatting (raw text). You do this by VBE (Alt+F11) >
Immediate Window (Ctrl+G) > ActiveDocument.ConvertNumbersToText
Then translate. Then modify this routine,an excerpt from my Word VBA
Spellbook, below as needed:
Convert manual formatting to styles
============================
Public Sub ConvertHardCoded2Styles()
Const NumberStyle As String = "List Number"
Const BulletStyle As String = "List Bullet"
Dim CharPos As Long
Dim Para As Paragraph
Dim BulletChars As String
Dim s As String
BulletChars = "." & "*" & "-" & Chr$(176) & ChrW$(61623) &
ChrW$(61607) & ChrW$(61608) _
& ChrW$(61609) & ChrW$(61610) & ChrW$(61528) & ChrW$(61529) &
ChrW$(61556) & _
ChrW$(61557) & ChrW$(61558) & ChrW$(61559) & ChrW$(61562) & _
ChrW$(8224) & ChrW$(8225) & ChrW$(9679)
With ActiveDocument
For Each Para In .Paragraphs
With Para
s = Mid$(.Range.Text, 1, 1)
If StrConv(s, vbUnicode) = Format(Val(s)) Then 'number!
.Style = NumberStyle
StripStartOfPara Para
ElseIf InStr(1, BulletChars, s) Then
.Style = BulletStyle
StripStartOfPara Para
End If
End With
Next
End With
Set Para = Nothing
End Sub
"Tony Dai" <asia...@sina.com> was spinning this yarn:
Steve Hudson
Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email: word_h...@yahoo.com.au
Products: http://www.geocities.com/word_heretic/products.html
Spellbooks: 1129 pages of dump left and dropping...
The VBA Beginner's Spellbook: For all VBA users.
Probably just a timing thing as my posts go via usenet dissemination -
the Web access still seems to be a separate problem.
Margaret
In article <#X5RqGFCD...@TK2MSFTNGP10.phx.gbl>, Suzanne S. Barnhill
--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://www.mvps.org/word
"Margaret Aldis" <margare...@nospam.demon.co.uk> wrote in message
news:RFZOSeC0...@syntagma.demon.co.uk...
In article <u8VDz5MC...@TK2MSFTNGP10.phx.gbl>, Suzanne S. Barnhill