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.