Bonjour,
Salut, rien ne se passe? j'ai oublié un truc?
il faut ajouter la macro à l'événement de votre choix,
par exemple pour exécuter la macro "Export_Shape" à l'ouverture du fichier,
copier la macro suivante sur la page code de ThisWorkbook (ps/ c'est déjà fait dans le fichier joint)
Private Sub Workbook_Open()
Export_Shape
End Sub
j'ai fais une petite modification pour le nom des images provenant de graphique
Sub Export_Shapes()
'enregistrer shape et graph en image
Application.ScreenUpdating = False
Répertoire = "C:\Users\dario\Desktop\encours\" 'à adapter
Set sh1 = Sheets("TDC_Stat")
'ce graph sera utiliser comme réceptacle des images
Set sh2 = Worksheets.Add
sh2.Shapes.AddChart
For i = 1 To sh1.Shapes.Count
Select Case sh1.Shapes(i).Type
Case 3 'msoChart
Set MyChart = sh1.Shapes(i).Chart
MyChart.Export Filename:=Répertoire & sh1.Shapes(i).Name & ".png", filtername:="png"
Case Else
sh1.Shapes(i).CopyPicture
sh2.Select
sh2.ChartObjects("Graphique 1").Activate
ActiveChart.Paste
With sh2.ChartObjects("Graphique 1").Chart
.Export Filename:=Répertoire & sh1.Shapes(i).Name & ".png", filtername:="png"
End With
ActiveChart.Pictures(1).Delete
End Select
Next
sh1.Select
Application.DisplayAlerts = False
sh2.Delete
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub