View Single Post
  #16  
Old September 17th, 2004, 10:44 PM
Jean-Guy Marcil
external usenet poster
 
Posts: n/a
Default

Bonjour,

Dans son message, Jason L écrivait :
In this message, Jason L wrote:

|| Jean-Guy,
||
|| Good question. The words Recommendations and Discussion are the
beginning
|| of new sections in this document. No matter how much the merged data
|| changes, these words always indicate the beginning of new sections.
Each
|| numbered list in the section must start from 1. The insert section
breaks
|| automatically restart the numbering for the following section. This is
why
|| I'm using section breaks.
||
|| Here is how it looks before the section break:
||
|| Discussion:
||
|| 1.dsfds
|| 2.sdfdsa
|| 3.sdfsdaf
|| 4.sdfsf
|| 5.dsfsd
||
|| Recommendations:
|| 6.dsfsa
|| 7.sdfdsfs
|| 8.dsfdsafsad
|| 9.sdfadfds
||
|| after section break is inserted:
||
|| Discussion:
|| 1.dsfds
|| 2.sdfdsa
|| 3.sdfsdaf
|| 4.sdfsf
|| 5.dsfsd
||
|| Recommendations:
|| 1.dsfsa
|| 2.sdfdsfs
|| 3.dsfdsafsad
|| 4.sdfadfds
||
|| Does this help?
||

Then, shouldn't the section break be placed before the key word? Also, on my
machine, inserting a section breaks does not automatically restart the
numbering? How do you do that?

Also, you could restart the numbering after each key word?
But for this, you need a very robust document and you have to make sure that
all numbering was done from the same list template. In fact, it would be
better if you created your own list template and applied it to the
numbering.

In any case, here is some code you could adapt for such a scenario:

'_______________________________________
Sub RestartNumberingAfterKeyWord()
Const LookFor As String = "Recommendations:"
Dim FoundRange As Range

With ActiveDocument.Content.Find
.ClearFormatting
.Text = LookFor
With .Font
.Name = "Times New Roman"
.Bold = True
.Size = 11
End With
Do While .Execute
With .Parent
Set FoundRange = .Paragraphs(1).Range
With FoundRange
.MoveStart wdParagraph
If .ListFormat.ListValue 1 Then
Dim MyListTemp As ListTemplate
Set MyListTemp = .ListFormat.ListTemplate
.ListFormat.ApplyListTemplate _
ListTemplate:=MyListTemp, _
ContinuePreviousList:=False
End If
End With
End With
Loop
End With
End Sub
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org