Sub RedimensionnerShape()
Dim image As Shape, RapportL As Double, RapportH As Double
On Error Resume Next
'essayer de récupérer l'image ou la forme sélectionnée
Set image = ActiveWindow.Selection.ShapeRange(1)
'si rien n'était sélectionné, récupérer la première forme de la feuille
If image Is Nothing Then Set image = ActiveWindow.Selection.SlideRange(1).Shapes(1)
On Error GoTo 0
If image Is Nothing Then
MsgBox "La diapositive ne semble pas contenir d'images."
Exit Sub
End If
'redimensionner l'image / la forme
With image
.Left = 0
.Top = 0
RapportL = .Width / .Parent.Design.SlideMaster.Width
RapportH = .Height / .Parent.Design.SlideMaster.Height
If RapportH < RapportL Then
.Width = .Parent.Design.SlideMaster.Width
Else
.Height = .Parent.Design.SlideMaster.Height
End If
End With
End Sub