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

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.

Prep4PDF preserves interactivity in PowerPoint presentations when you convert to PDF

Reformat all instances of a particular phrase

Problem

Suppose you're doing a class lesson in PowerPoint and want to highlight all instances of a particular phrase by making it bold or changing its color, etc.
It's possible to do the job manually, but it could be very tedious. Nearly, but not quite, as tedious as reading my prose.

Using a simple macro, though, you can have the job done in seconds:

Solution

Sub FormatThePhrase()

Dim oSl As Slide
Dim oSh As Shape
Dim lStartPos As Long
Dim sSearchPhrase As String

' EDIT THIS TO REFLECT THE PHRASE YOU'RE LOOKING FOR
sSearchPhrase = "my phrase"

For Each oSl In ActivePresentation.Slides
    For Each oSh In oSl.Shapes
        If oSh.HasTextFrame Then
            If oSh.TextFrame.HasText Then
                lStartPos = InStr(UCase(oSh.TextFrame.TextRange.Text), UCase(sSearchPhrase))
                If lStartPos > 0 Then
                    ' one example of how you can change the text formatting
                    ' do whatever else is needed here:
                    oSh.TextFrame.TextRange.Characters(lStartPos, Len(sSearchPhrase)).Font.Bold = True
                End If
            End If
        End If
    Next
Next

End Sub

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


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 - 2015 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.
Español    Deutsch    Français    Português    Italiano    Nederlands    Greek    Japanese    Korean    Chinese

Supercharge your PPT Productivity with PPTools

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

Reformat all instances of a particular phrase
http://www.pptfaq.com/FAQ00885_Reformat_all_instances_of_a_particular_phrase.htm
Last update 07 June, 2011
Created: