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
|
Sub Resize()
Dim oSec As Section
Dim oHeader As HeaderFooter
Dim oLogo As InlineShape, oIshp As InlineShape
Dim PercentSize As Single
Dim oshp As Shape
With ActiveDocument
For Each oSec In .Sections
If oSec.Headers(wdHeaderFooterPrimary).Exists Then
Set oHeader = oSec.Headers(wdHeaderFooterPrimary)
With oHeader.Range
If .InlineShapes.Count > 0 Then
Set oLogo = .InlineShapes(1)
With oLogo
.ScaleHeight = 75
.ScaleWidth = 100
End With
Set oLogo = Nothing
End If
End With
Set oHeader = Nothing
End If
Next oSec
'le bout suivant fonctionne pour les images qui ne sont pas dans l'en-tête
PercentSize = 100
For Each oIshp In .InlineShapes
With oIshp
.ScaleHeight = PercentSize
.ScaleWidth = PercentSize
End With
Next oIshp
For Each oshp In .Shapes
With oshp
.ScaleHeight Factor:=(PercentSize / 100), RelativeToOriginalSize:=msoCTrue
.ScaleWidth Factor:=(PercentSize / 100), RelativeToOriginalSize:=msoCTrue
End With
Next oshp
End With
End Sub |
Partager