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 77 78 79 80 81
| Sub exportppt_test()
'déclaration variable
Dim PPTapp As PowerPoint.Application
Dim PPTPres As PowerPoint.Presentation
Dim PPTSlide As PowerPoint.Slide
Dim PPTShape As PowerPoint.Shape
Dim PPTplaceholder As PowerPoint.PlaceholderFormat
Dim XLbook As Workbook
Dim XLsheet As Worksheet
Dim XLrange As Excel.Range
Dim Feuille_fils As Worksheet
Dim strfile As Variant
On Error Resume Next
Dim strfileName As Variant
'effacer données excel
Sheets("data").Range("A1").Clear
For Each Feuille_fils In Worksheets
Application.DisplayAlerts = False
If Feuille_fils.Name <> "data" Then Feuille_fils.Delete
Next
Application.DisplayAlerts = True
'Ouvrir la Présentation
strfile = Application.GetOpenFilename()
If strfile <> False Then
On Error Resume Next
Set PPTapp = GetObject(, "PowerPoint.Application")
If IsEmpty(PPTapp) Then Set PPTapp = CreateObject("PowerPoint.Application")
PPTapp.Visible = True
Set PPTPres = PPTapp.Presentations(strfile)
On Error GoTo 0
If IsEmpty(PPTPres) Then
Init = Now
Set PPTPres = PPTapp.Presentations.Open(strfile)
MyTimer = Timer
Do While IsEmpty(PPTPres) And Timer < Timer + 30
DoEvents
Loop
End If
End If
Set Feuille_fils = ActiveWorkbook.Sheets.Add(After:=ActiveWorkbook.Worksheets(ActiveWorkbook.Worksheets.Count))
ActiveSheet.Name = "pour offi"
'reprendre les info de la slide
For Each PPTSlide In PPTPres.Slides 'dans un deuxième temps faire que pour page 1
'récupérer le info
If PPTShape.Type = msoPlaceholder Or PPTshapes.Type = PPTplaceholderverticalObject Then
'placer le texte dans excel
Set XLrange = XLsheet.Range("A10000").End(xlUp)
'gérer la boucle
If XLrange.Value <> "" Then
Set XLrange = XLrange.Offset(1, 0)
End If
'prendre toutes les formes
XLrange.Value = PPTShape.TextFrame.TextRange
XLrange.Offset(0, 1).Value = PPTSlide.Name
XLrange.Offset(0, 2).Value = PPTSlide.SlideIndex
XLrange.Offset(0, 3).Value = PPTSlide.Layout
XLrange.Offset(0, 4).Value = PPTShape.Name
XLrange.Offset(0, 5).Value = PPTShape.Type
End If
Next
End Sub |
Partager