The following function iterates through all slides in the given presentation and collects the title text of the slide if it is present. If the title is not present, it collects the slide name.

Sub CollectSlideTitles(ByVal Pres As Presentation, _
    ByRef SldTitles As Collection)

    Dim Sld As Slide
    Dim SldTitle As String

    For Each Sld In Pres.Slides
        SldTitle = ""
        If Sld.Shapes.HasTitle Then
            If Sld.Shapes.Title.HasTextFrame Then
                If Sld.Shapes.Title.TextFrame.HasText Then
                    SldTitle = Sld.Shapes.Title.TextFrame.TextRange.Text
                End If
            End If
        End If
        If SldTitle = "" Then
            SldTitle = Sld.Name
        End If
        SldTitles.Add SldTitle
End Sub

Contact OfficeOne on email at Copyright © 2001-2023 OfficeOne. All rights reserved.