Sub ImagePlageCellules()
Dim F As Worksheet
Dim Répertoire As String
Dim img As Shape
Set F = Worksheets("Feuil1")
Répertoire = ActiveWorkbook.Path & "\" & "Monimage.jpg"
With F
'La plage de cellules A4:F6 est copiée dans le Presse-papiers en tant qu'image.
.Range("A4:F6").CopyPicture
'L'image est collée dans la feuille active
.Paste
End With
' renomme l'image
Selection.Name = "Image 1"
'Selection.CopyPicture
Set img = F.Shapes("Image 1")
F.ChartObjects.Add(0, 0, img.Width, img.Height).Chart.Paste
F.ChartObjects(1).Chart.Export Filename:=Répertoire, FilterName:="jpg"
F.ChartObjects(1).Delete
img.Delete
ActiveSheet.PageSetup.CenterFooterPicture.Filename = Répertoire
With ActiveSheet.PageSetup
.CenterFooter = "&G"
End With
End Sub