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
| Dim oPPTApp As PowerPoint.Application
Dim oPPTShape2 As PowerPoint.Shape
'declarations sur le fichier excel base de données
Dim principal As ThisWorkbook
Set principal = ThisWorkbook
'Ouverture des fichiers
Dim repertoire As String, fichier As String
Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Set PPApp = CreateObject("Powerpoint.Application")
PPApp.Visible = True
'Dim PPSlide As PowerPoint.Slide
Dim i As Integer
Dim SlideNum As String
'------------------------------------------------------
'Identification des fichiers dans le dossier
'Call IdentificationFichiers
'-----------------------------------------------------------------------------------------------------------------------
'Travail sur le repertoire contenant les fichiers Powerpoint
repertoire = "\\bla\"
ChDir repertoire
fichier = Dir(repertoire & "*.pptx")
i = 1
Do While Len(fichier) > 0
'***************************
Set PPPres = PPApp.Presentations.Open(fichier)
'Actions sur le fichier ppt
Dim Variable1, Variable2 As String
Variable1 = fichier 'Variable 1: Nom fichier
SlideNum = 2
'ActivePresentation.Slides(1).Select 'On va sur la slide 2 qui contient les infos a extraire
'Dim objsld2 As Slide
'Set objsld2 = PPPres.Slides(2) 'On va sur la slide 2 qui contient les infos a extraire
Variable2 = ActivePresentation.Slides(SlideNum).Shapes("NomResponsableEtDate").TextFrame.TextRange.Text
'ordre.Offset(j, 0).Value = texte_C1
'Pres.Close 'fermeture du ppt
'*****************************
'*****************************
'Collage des actions du fichier ppt sur le fichier Excel
ThisWorkbook.Activate
Sheets("Database").Range("A" & i) = Variable1
Sheets("Database").Range("B" & i) = Variable2
'*****************************
fichier = Dir()
i = i + 1
Loop
'-----------------------------------------------------------------------------------------------------------------------
End Sub |
Partager