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 42 43 44 45 46 47 48 49 50 51 52 53 54
|
Sub RepererLaPositionDesGroupes()
Dim I As Integer, J As Integer, IndexMatrice As Integer
Dim WdDoc As Document
Dim MatriceShapes() As Variant
Set WdDoc = ActiveDocument
IndexMatrice = 0
With WdDoc
For I = 1 To .Shapes.Count
With .Shapes(I)
Select Case .Type
Case 6, 9, 13, 17
ReDim Preserve MatriceShapes(3, IndexMatrice)
MatriceShapes(0, IndexMatrice) = .Name
MatriceShapes(1, IndexMatrice) = .Anchor.Information(wdActiveEndPageNumber)
MatriceShapes(2, IndexMatrice) = .Anchor.Information(wdVerticalPositionRelativeToPage)
IndexMatrice = IndexMatrice + 1
' Debug.Print I & " : " & .Name & " : " _
' & .Anchor.Information(wdActiveEndPageNumber) & " : " _
' & .Anchor.Information(wdVerticalPositionRelativeToPage)
End Select
End With
Next I
For I = .Paragraphs.Count To 1 Step -1
With .Paragraphs(I).Range
For IndexMatrice = LBound(MatriceShapes, 2) To UBound(MatriceShapes, 2)
If .Information(wdActiveEndPageNumber) = MatriceShapes(1, IndexMatrice) _
And .Information(wdVerticalPositionRelativeToPage) = MatriceShapes(2, IndexMatrice) Then
MatriceShapes(3, IndexMatrice) = I
End If
Next IndexMatrice
' Debug.Print I & " : " & .Information(wdActiveEndPageNumber) & " : " _
' & .Information(wdVerticalPositionRelativeToPage)
End With
Next I
End With
For IndexMatrice = LBound(MatriceShapes, 2) To UBound(MatriceShapes, 2)
Debug.Print "Page : " & MatriceShapes(1, IndexMatrice) & ", paragraphe : " & MatriceShapes(3, IndexMatrice) & ", shape : " & MatriceShapes(0, IndexMatrice)
Next IndexMatrice
Set WdDoc = Nothing
End Sub |
Partager