Hi =?Utf-8?B?UGF0cmljaw==?=,
I use Word 2002 (XP).
You're right : I mean "Paragraph-by-paragraph" because all line is a
paragraph.
OK, normally, one would do something like this:
Sub ModifyParas()
Dim doc as Word.Document
Dim para as Word.Paragraph
Set doc = ActiveDocument
For each para in doc.Paragraphs
'Put the code here to manipulate the paragraph
Next
End Sub
BUT, since you may delete the paragraphs, the internal indexing system that keeps
track of the Paragraphs collection might get mixed up, so you could end up missing
paragraphs when you loop. In situations like that, it's better to start at the end
and work your way to the front:
Sub ModifyAndDeleteParas()
Dim lNrParas as Long
Dim counter as Long
Dim doc as Word.Document
Dim para as Word.Paragraph
Set doc = ActiveDocument
lNrParas = doc.Paragraphs.Count
For counter = lNrParas to 1 Step -1
'Do the work here
Set para = doc.Paragraphs(counter)
If para... 'Test condition here
para.Range.Delete
Else
End If
Next
End Sub
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
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
