1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Sub DimensionsPage()
With ActiveDocument.PageSetup
'Selon l'image (portrait ou paysage), ce sera l'un ou l'autre
'HauteurDispo = .PageHeight - .TopMargin - .BottomMargin - .HeaderDistance - .FooterDistance
LargeurDispo = .PageWidth - .LeftMargin - .RightMargin
End With
With Selection
.InlineShapes.AddPicture FileName:= _
"D:\2005 - Grenoble\Télécabine de la Bastille.jpg" _
, LinkToFile:=False, SaveWithDocument:=True
End With
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
With Selection
LargeurImage = Selection.InlineShapes(1).Width
hauteur = .InlineShapes(1).Height * LargeurImage / LargeurDispo
largeur = .InlineShapes(1).Width * LargeurImage / LargeurDispo
.InlineShapes(1).Height = hauteur
.InlineShapes(1).Width = largeur
End With
End Sub |
Partager