Results 1 to 7 of 7
  1. #1
    Star Lounger
    Join Date
    Feb 2003
    Location
    Annapolis, Maryland, USA
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Creating titles for slides (2002 SP3)

    Thanks to Hans for that last macro. Of course, it didn't work, yet. About half of the slides don't have titles. They do have text that should be used as the titles, but for whatever reason weren't set up that way. Is there a way to select a text box and set it as the title for the slide?

    Again, thanks!

    Michael
    Michael Coleman
    BOMI International

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Creating titles for slides (2002 SP3)

    How should a macro determine which text on a slide should be used as a title?

  3. #3
    Star Lounger
    Join Date
    Feb 2003
    Location
    Annapolis, Maryland, USA
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Creating titles for slides (2002 SP3)

    There are several text boxes on most slides, so I'd have to click on the correct box one slide at a time.
    Michael Coleman
    BOMI International

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Creating titles for slides (2002 SP3)

    As far as I know (but that doesn't say much, I'm not very familiar with PowerPoint VBA), you can't point to text boxes while a macro runs. So you'll have to modify the slides to have a proper Title text box before running the macro.

  5. #5
    Star Lounger
    Join Date
    Feb 2003
    Location
    Annapolis, Maryland, USA
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Creating titles for slides (2002 SP3)

    Darn. That's what I was afraid of. I was hoping for a way to tell a text box to act as the Title text box.
    Michael Coleman
    BOMI International

  6. #6
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Creating titles for slides (2002 SP3)

    Is the title textbox always the top-most textbx with text? Or is the textbox the one with the largest text? There must be someway of identifying the titles. Is the Powerpoint summary slide correct?
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  7. #7
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Creating titles for slides (2002 SP3)

    OK, Mike has gone to lunch, so I get to make the specs for determining what is the title: <img src=/S/joy.gif border=0 alt=joy width=23 height=23>
    First, if the slide has the first shape as a placeholder, then it was created normally & this is the title
    Otherwise, use the top-most text on the slide.
    However, all of this is overridden if the author has double-clicked on the box containing the title, selected the Web tab on the format dialog and entered Title as the Alternative text. This override will be used no matter what.

    <pre>Sub ListSlides()
    Dim i As Integer
    Dim strList As String
    Dim d As New MSForms.DataObject
    Dim shp As Shape, shpTop As Shape
    Dim isFound As Boolean
    strList = "List of slides in " & ActivePresentation.Name
    For i = 1 To ActivePresentation.Slides.Count
    With ActivePresentation.Slides(i)
    isFound = False
    ' See if there is a shape whose webtext is "Title"
    For Each shp In .Shapes
    If shp.AlternativeText = "Title" Then
    strList = strList & vbCrLf & i & vbTab & _
    shp.TextFrame.TextRange.Text
    isFound = True
    Exit For
    End If
    Next shp
    ' If first shape is a placeholder, this is the title
    If Not isFound Then
    If .Shapes(1).Type = msoPlaceholder Then
    strList = strList & vbCrLf & i & vbTab & _
    .Shapes(1).TextFrame.TextRange.Text
    isFound = True
    End If
    End If
    ' Otherwise use the top-most text
    If Not isFound Then
    Set shpTop = Nothing
    For Each shp In .Shapes
    If shp.HasTextFrame Then
    Set shpTop = shp
    Exit For
    End If
    Next shp
    If Not shpTop Is Nothing Then
    For Each shp In .Shapes
    If shp.HasTextFrame And _
    shp.Top < shpTop.Top Then
    ' Top-most has smallest top!
    Set shpTop = shp
    End If
    Next shp
    End If
    If Not shpTop Is Nothing Then
    strList = strList & vbCrLf & i & vbTab & _
    shpTop.TextFrame.TextRange.Text
    isFound = True
    End If
    End If
    ' Flag slides without a title
    If Not isFound Then _
    strList = strList & vbCrLf & i & vbTab & "No Title"
    End With
    Next i
    d.SetText strList
    d.PutInClipboard
    Set d = Nothing
    MsgBox "The list of slides is on the clipboard, " & _
    "ready to be pasted.", vbInformation
    End Sub
    </pre>

    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •