Bonjour,
je travaille sur une présentation powerpoint faite de 20 graphiques générés sous Excel (grace à pleins d'astuces trouvées sur le forum d'ailleurs ! :kiss🙂.
Mon souci est qu'avec 20 graphiques transférés, mon fichier powerpoint destination pèse 1 tonne (ou plutôt 20 mégas).
Est-ce que qqu'un sait comment faire un 'collage spécial/ métafichier amélioré' en vba.
Ci joint mon code dans excel.
Merci d'avance !
Sub Graphique_XLtoPpt()
'necessite d'activer la reference Microsoft Powerpoint Object Library
Dim PPT As PowerPoint.application
Dim PptDoc As PowerPoint.Presentation
Dim NbShpe As Byte
Dim FILE, ONGLET, GRAPH As String
Dim NOMACTIVESHEET As String
Dim NOMACTIVESHEET As String
Set PPT = CreateObject('Powerpoint.Application') 'creation session PowerPoint
PPT.Visible = True
NOMACTIVESHEET = Cells(29, 16).Value
FILE = Sheets(NOMACTIVESHEET).Cells(2, 4).Value
Set PptDoc = PPT.Presentations.Open(FILE) 'ouverture fichier ppt
NBOCCURENCES = WorksheetFunction.CountA(Range('$B$8:$B$27'))
For i = 1 To NBOCCURENCES
Sheets(ONGLET).ChartObjects(GRAPH).Copy 'copie
PptDoc.Slides(SLIDE).Shapes.Paste 'collage dans le Slide du document Power Point
Next
PptDoc.Save
PptDoc.Close
End Sub
je travaille sur une présentation powerpoint faite de 20 graphiques générés sous Excel (grace à pleins d'astuces trouvées sur le forum d'ailleurs ! :kiss🙂.
Mon souci est qu'avec 20 graphiques transférés, mon fichier powerpoint destination pèse 1 tonne (ou plutôt 20 mégas).
Est-ce que qqu'un sait comment faire un 'collage spécial/ métafichier amélioré' en vba.
Ci joint mon code dans excel.
Merci d'avance !
Sub Graphique_XLtoPpt()
'necessite d'activer la reference Microsoft Powerpoint Object Library
Dim PPT As PowerPoint.application
Dim PptDoc As PowerPoint.Presentation
Dim NbShpe As Byte
Dim FILE, ONGLET, GRAPH As String
Dim NOMACTIVESHEET As String
Dim NOMACTIVESHEET As String
Set PPT = CreateObject('Powerpoint.Application') 'creation session PowerPoint
PPT.Visible = True
NOMACTIVESHEET = Cells(29, 16).Value
FILE = Sheets(NOMACTIVESHEET).Cells(2, 4).Value
Set PptDoc = PPT.Presentations.Open(FILE) 'ouverture fichier ppt
NBOCCURENCES = WorksheetFunction.CountA(Range('$B$8:$B$27'))
For i = 1 To NBOCCURENCES
Sheets(ONGLET).ChartObjects(GRAPH).Copy 'copie
PptDoc.Slides(SLIDE).Shapes.Paste 'collage dans le Slide du document Power Point
Next
PptDoc.Save
PptDoc.Close
End Sub