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.

Highlight text in PowerPoint

Problem

How come you can highlight text in Word but not in PowerPoint?

We don't have a good answer for that one other than "Because Bill says so." And that's just an answer, not a good one.

Solution

We do have a workaround. This macro will add a yellow rectangle behind any selected text. You can edit it to change the color if the boss prefers violet or puce or ... well, whatever. No accounting for taste, is there?

The companion UnHighlight macro will remove any of these highlights from your slide.

Sub Highlight()

    Dim oRng As TextRange
    Dim lLineCount As Long
    Dim oRect As Shape
    Dim dOffset As Double
    Dim lFillColor As Long

    ' EDIT THESE AS NEEDED
    ' dOffset sets the amount of padding added around the text (in points)
    dOffset = 2
    ' change this to get a different highlight color
    lFillColor = RGB(255, 255, 128)

    With ActiveWindow.Selection.TextRange
        For lLineCount = 1 To .Lines.Count
            Set oRng = .Lines(lLineCount)
            With oRng
                Set oRect = ActiveWindow.Selection.SlideRange.Shapes.AddShape(msoShapeRectangle, _
                    .BoundLeft - dOffset, _
                    .BoundTop - dOffset, _
                    .Boundwidth + dOffset, _
                    .Boundheight + dOffset)
                With oRect
                    ' format it
                    .Fill.Visible = msoTrue  ' in case default fill's set to invisible
                    .Fill.ForeColor.RGB = lFillColor
                    .Line.Visible = msoFalse
                    ' tag it so we can find/delete it later
                    Call .Tags.Add("Highlight", "YES")
                    ' send it behind the text
                    While Not .ZOrderPosition < ActiveWindow.Selection.ShapeRange(1).ZOrderPosition
                        .ZOrder msoSendBackward
                    Wend
                End With
            End With
        Next
    End With

End Sub

Sub UnHighlight()
' Removes highlights

    Dim oSh As Shape
    Dim x As Long

    With ActiveWindow.Selection.SlideRange(1)
        For x = .Shapes.Count To 1 Step -1
            Set oSh = .Shapes(x)
            If oSh.Tags("Highlight") = "YES" Then
                oSh.Delete
            End If
        Next
    End With

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 - 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

Highlight text in PowerPoint
http://www.pptfaq.com/FAQ00776_Highlight_text_in_PowerPoint.htm
Last update 07 June, 2011
Created: