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 31 32 33 34 35 36 37 38 39 40 41
|
Sub SuppressionLignesVides()
Dim DocEnCours As Document
Dim SignetNom As Bookmark
Dim I As Integer, NumeroParagraphe As Integer
Set DocEnCours = ActiveDocument
With DocEnCours
If .Bookmarks.Exists("SignetNomPrenom") Then
.Bookmarks("SignetNomPrenom").Range.Select
Selection.HomeKey unit:=wdStory, Extend:=wdExtend
NumeroParagraphe = Selection.Paragraphs.Count
.Paragraphs(NumeroParagraphe).Range.Select
' Debug.Print "Paragagraphe : " & NumeroParagraphe & ", " & Selection.Range.Text
For I = NumeroParagraphe + 3 To NumeroParagraphe + 1 Step -1
.Paragraphs(I).Range.Select
If I = NumeroParagraphe + 3 And Len(Selection.Range.Text) = 4 Then
' Debug.Print "Paragagraphe : " & I & ", " & Len(Selection.Range.Text)
Selection.Delete
End If
If I = NumeroParagraphe + 2 And Len(Selection.Range.Text) = 5 Then
'Debug.Print "Paragagraphe : " & I & ", " & Len(Selection.Range.Text)
Selection.Delete
End If
If I = NumeroParagraphe + 1 And Len(Selection.Range.Text) = 4 Then
'Debug.Print "Paragagraphe : " & I & ", " & Len(Selection.Range.Text)
Selection.Delete
End If
Next I
End If
End With
Set DocEnCours = Nothing
End Sub |
Partager