Hi
I don't know if this belongs here or in the PP subfora?
I am looking for a code (in Excel) that can open up PowerPoint and loop through each slide to get the Titles. The goal is to make a list in Excel of EACH slide (=also the slides without a proper Title shape).
Today we do this manually with a PP Module where we generate an Notepad.txt document from which we then Ctrl+C/V into our Excel.
Why? The purpose of this exercise is to generate a Table of Contents of our Management Reporting presentation, where some of our Senior Management wants a hardcopy of the presentation with a TOC. And so far, this method has been the best used. In Excel we add the slide numbers from a "ROW()" formula. (Why it is important to also get slides without title)
Our code in PowerPoint now is:
Sub getTitles2()
Dim PPSlide As Slide
Dim sReport As String
Dim iFilenum As Integer
Dim FilePath As String
For Each PPSlide In ActivePresentation.Slides
If PPSlide.Shapes.HasTitle Then
If PPSlide.Shapes.Title.TextFrame.HasText Then
sReport = sReport & PPSlide.Shapes.Title.TextFrame.TextRange & vbCrLf
Else:
sReport = sReport & "No title text" & vbCrLf
End If
Else
sReport = sReport & "No title" & vbCrLf
End If
Next PPSlide
iFilenum = FreeFile
FilePath = Environ("TEMP") & "\data.txt"
Open FilePath For Output As iFilenum
Print #iFilenum, sReport
Close iFilenum
Call Shell("Notepad.exe " & FilePath, vbNormalFocus)
End Sub
In summary: Extract the titles and insert them into Sheet(x) starting from A1 and down.
Is this possible?
Best regards
Rasmus