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
|
Sub TestPowerPoint()
' On déclare une variable de type Application PowerPoint
Dim PPT As PowerPoint.Application
' On crée maintenant un objet Presentation
Dim Pres As PowerPoint.Presentation
Set PPT = CreateObject("PowerPoint.Application")
PPT.Visible = True ' Indispensable, sinon il ne peut pas ouvrir de fichier (Erreur)
' Et on lui dit de quelle présentation il s'agit :
Set Pres = PPT.Presentations.Open(Filename:="C:\Présentation1.ppt")
' On active, sélectionne et copie le Graphique Graphique 1 de Excel :
Sheets("Feuille1").Select
Range("A1:G3").Select
Selection.Copy
PPT.Presentations(PPT.Presentations.Count).Slides(1).Shapes.Paste ppPasteMetafilePicture
Sheets("Feuille2").Select
Range("A1:C4").Select
Selection.Copy
PPT.Presentations(PPT.Presentations.Count).Slides(2).Shapes.Paste ppPasteMetafilePicture
Sheets("Feuille3").Select
Range("A1:D39").Select
Selection.Copy
PPT.Presentations(PPT.Presentations.Count).Slides(3).Shapes.Paste ppPasteMetafilePicture
Sheets("Feuille4").Select
Range("A1:S13").Select
Selection.Copy
PPT.Presentations(PPT.Presentations.Count).Slides(4).Shapes.Paste ppPasteMetafilePicture
' On enregistre la présentation PowerPoint :
Pres.Save
' Et on quitte PowerPoint proprement :
PPT.Quit
Set PPT = Nothing
End Sub |
Partager