Pb ".Export" avec Microsoft Excel 2016 : le graphique est vide
Bonjour
J'ai un petit programme qui marchait bien en Microsoft Excel 2010.
Il est très simple il copie 3 images de la feuille "feuilles_courbes", et créé 3 fichiers .gif sous "C:\Temp".
Je vais changer de PC, avec Microsoft Excel 2016., et je m'aperçois que le programme ne marche plus.
les 3 fichiers .gif sont vides.
Il semble qu'il y ait un pb avec la fonction ".Export".
Quelqu'un saurait-il m'aider ?
Voici mon programme :
Code:
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 |