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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
| Option Explicit
Dim appPPoint As powerpoint.Application
Dim Presentation, Maitre As powerpoint.Presentation
Dim diapositive As powerpoint.Slides
Dim ppLayoutTitle As powerpoint.PpSlideLayout
Dim derniereslide, pagecount, c, d As Integer
Dim str, myfile, chemin, chemin_final As String
Sub Créer_présentation()
'chemin du répertoire
chemin = Workbooks(ActiveWorkbook.Name).Path
str = "Titre_bidon"
chemin_final = chemin & "\fichier.pptx"
'créer présentation
Set appPPoint = New powerpoint.Application
'enregistrer et fermer
With appPPoint.Presentations.Add
.SaveAs chemin_final
.Close
End With
'ré-ouvrir
Set Maitre = appPPoint.Presentations.Open(chemin_final, withWindow:=msoFalse)
'création 1ère slide
Set pptSlide = Maitre.Slides.AddSlide(1, ppLayoutTitle)
Set diapositive = Maitre.Slides(1)
diapositive.Shapes(1).TextFrame.TextRange = "Titre : " & str
diapositive.Shapes(2).TextFrame.TextRange = "Line 1" & vbNewLine & _
"Line 2" & vbNewLine & _
"Line 3" & vbNewLine & _
"Line 4" & vbNewLine
'récupérer les presentation aux noms contenus AA2 et compagnie
derniereslide = 1
For c = 2 To d
myfile = Sheets("accueil").Cells(c, 27).Value 'récupérer nom
chemin_final = chemin & "\" & myfile
'travail dans powerpoint
Set Presentation = appPPoint.Presentations.Open(chemin_final, withWindow:=msoFalse)
pagecount = Presentation.Slides.Count
Maitre.Slides.InsertFromFile chemin & "\" & myfile, derniereslide, 1, pagecount
derniereslide = derniereslide + pagecount
Presentation.Close
Next c
'enregistrer et fermer
With Maitre
.Save
.Close
End With
'effacer colonne de travail
Sheets("accueil").Activate
Columns("AA:AA").ClearContents
End Sub |
Partager