1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| aTexteFinal = ""
aDerniereConditionTrouvée = ""
For aI = ActiveDocument.Paragraphs.Count To 1 Step -1
If InStr(ActiveDocument.Paragraphs(aI).Range.Text, "Condition") = 1 Then
'// On a une ligne "Condition de circulation"
aDerniereConditionTrouvée = Mid(ActiveDocument.Paragraphs(aI).Range.Text, 1, Len(ActiveDocument.Paragraphs(aI).Range.Text) - 1)
Else
If Len(ActiveDocument.Paragraphs(aI).Range.Text) > 2 Then
aTexteFinal = Mid(ActiveDocument.Paragraphs(aI).Range.Text, 1, Len(ActiveDocument.Paragraphs(aI).Range.Text) - 1) + "$$$" + aDerniereConditionTrouvée + "$$$" + aTexteFinal
End If
End If
Next
ActiveDocument.Range.Text = aTexteFinal
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "$$$"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll |
Partager