SoFunction
Updated on 2025-03-10

vba code to get all titles in PPT slideshow


Private Sub CommandButton1_Click()
= False
getTitles
= True
End Sub


Sub getTitles()
On Error Resume Next
Dim oPres As Presentation
Set oPres =
Dim oSlide As Slide
Dim oShape As Shape
Dim tr As TextRange
Dim sText As String
Dim i As Long, j As Long
'Loop every page of slides
For i = 1 To
Set oSlide = (i)
'Get the graphical object
For j = 1 To
Set oShape = (j)
'If there is text
If = msoTrue Then
Set tr =
sText =
'If the format is in line with the situation: Set according to the situation, the first three digits here are
If IsNumeric(Left(sText, 3)) Then
'MsgBox sText
= 65535
= sText & vbCrLf
End If
Set tr = Nothing
End If
Set oShape = Nothing
Next
Set oSlide = Nothing
Next
Set oPres = Nothing
End Sub