Supercharge your PowerPoint productivity with
Supercharge your PPT Productivity with PPTools - Click here to learn more.

Proud member of

PPTools

Image Export converts PowerPoint slides to high-quality images.

PPT2HTML exports HTML even from PowerPoint 2010 and 2013, gives you full control of PowerPoint HTML output, helps meet Section 508 accessibility requirements

Merge Excel data into PowerPoint presentations to create certificates, awards presentations, personalized presentations and more

Resize your presentations quickly and without distortion

Language Selector switches the text in your presentation from one language to another

FixLinks prevents broken links when you distribute PowerPoint presentations

Shape Styles brings styles to PowerPoint. Apply complex formatting with a single click.

Create agenda slides with a "moving highlight"

Option Explicit

Sub AgendificateMe()

Dim X As Integer
Dim Y As Integer
Dim intParaCount As Integer
Dim oBodyText As Shape
Dim OBaseSlide As Slide
Dim oNewSlide As Slide
Dim oNewBodyText As Shape

' Note: RGB value for highlight color is hardcoded below.  Edit to suit.

Set OBaseSlide = ActiveWindow.Selection.SlideRange(1)
With OBaseSlide
    ' Get a reference to the body text placeholder
    For X = 1 To .Shapes.Placeholders.Count
        If .Shapes.Placeholders(X).PlaceholderFormat.Type = ppPlaceholderBody Then
            Set oBodyText = .Shapes.Placeholders(X)
        End If
    Next X

    ' No body text on the slide?  Squawk 'n run
    If oBodyText Is Nothing Then
        MsgBox "C'mon, WORK with me here, Karl!  I need text with BODY."
        Exit Sub
    End If

    intParaCount = oBodyText.TextFrame.TextRange.Paragraphs.Count
    For X = intParaCount To 1 Step -1
        Set oNewSlide = OBaseSlide.Duplicate(1)
        ' get a reference to the body text placeholder
        With oNewSlide
            For Y = 1 To .Shapes.Placeholders.Count
                If .Shapes.Placeholders(Y).PlaceholderFormat.Type = ppPlaceholderBody Then
                    Set oNewBodyText = .Shapes.Placeholders(Y)
                End If
            Next Y
            With oNewBodyText
                ' SET HIGHLIGHT COLOR AS DESIRED HERE:
                .TextFrame.TextRange.Paragraphs(X).Font.Color.RGB = RGB(255, 0, 0)
            End With
        End With ' oNewSlide
    Next X

End With

End Sub

See How do I use VBA code in PowerPoint? to learn how to use this example code.

Search terms:


Did this solve your problem? If so, please consider supporting the PPT FAQ with a small PayPal donation.
Page copy protected against web site content infringement by Copyscape Contents © 1995 - 2022 Stephen Rindsberg, Rindsberg Photography, Inc. and members of the MS PowerPoint MVP team. You may link to this page but any form of unauthorized reproduction of this page's contents is expressly forbidden.

Supercharge your PPT Productivity with PPTools

content authoring & site maintenance by
Friday, the automatic faq maker (logo)
Friday - The Automatic FAQ Maker

Create agenda slides with a "moving highlight"
http://www.pptfaq.com/FAQ00540_Create_agenda_slides_with_a_-moving_highlight-.htm
Last update 07 June, 2011
Created: