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
| Sub Creation_des_images()
'
Dim Plage As Range
Dim chemin As String
chemin = "C:\Temp"
Sheets("feuilles_courbes").Select ' sélection feuille "Trend_curves" du fichier KPI
Worksheets("feuilles_courbes").Activate
' création fichier image 1
Set Plage = ActiveSheet.Range("B2:K21")
Application.ScreenUpdating = False
Workbooks.Add: Plage.CopyPicture: ActiveSheet.Paste
With ActiveSheet.ChartObjects.Add(0, 0, Selection.Width, Selection.Height).Chart
.Paste
.Export chemin & "\Image_N01.gif", "GIF"
End With
ActiveWorkbook.Close False
' création fichier image 2
Set Plage = ActiveSheet.Range("B30:K41")
Application.ScreenUpdating = False
Workbooks.Add: Plage.CopyPicture: ActiveSheet.Paste
With ActiveSheet.ChartObjects.Add(0, 0, Selection.Width, Selection.Height).Chart
.Paste
.Export chemin & "\Image_N02.gif", "GIF"
End With
ActiveWorkbook.Close False
' création fichier image 3
Set Plage = ActiveSheet.Range("B50:K61")
Application.ScreenUpdating = False
Workbooks.Add: Plage.CopyPicture: ActiveSheet.Paste
With ActiveSheet.ChartObjects.Add(0, 0, Selection.Width, Selection.Height).Chart
.Paste
.Export chemin & "\Image_N03.gif", "GIF"
End With
ActiveWorkbook.Close False
End Sub |
Partager