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.

Remove underlines from descenders

Problem

When you underline text that includes lowercase characters, the results can be ugly. The underlines intersect the the descenders of characters like g, j, p, q and y (that is, characters that descend below the baseline).

PowerPoint MVP Geetesh Bajaj discusses the problem in more detail and explains how to fix it manually here on Indezine.com in his article Stop Underlining Your Descenders.

Fixing a few lines of underlined text is well worth the minimal effort it takes; it really does improve the appearance of your text. But what if you've got lots of text to fix? A whole presentation worth? Several whole presentations worth?

Doing it manually would be very tedious indeed. How about letting the computer do the work for you instead? Read on ...

Solution

The VBA code below will look at each text shape in your presentation and remove the underline from any character with descenders.

If you're working in a language with other characters that have descenders, add them to the sDescenders = "gjpqy" line in Function IsDescender below.

Sub FixAllDescenders()
' Removes underlines from all descenders in the presentation

    Dim oSl As Slide
    Dim oSh As Shape

    For Each oSl In ActivePresentation.Slides
        For Each oSh In oSl.Shapes
            If oSh.HasTextFrame Then
                If oSh.TextFrame.HasText Then
                    FixDescenders oSh
                End If
            End If
        Next
    Next

End Sub

Sub FixDescenders(oSh As Shape)
' Removes underlines from descenders in just the current shape

    Dim x As Long
    Dim oChar As TextRange
    With oSh
    If .HasTextFrame Then
    If .TextFrame.HasText Then
      For x = 1 To Len(.TextFrame.TextRange.Text)
        If IsDescender(Mid$(.TextFrame.TextRange.Text, x, 1)) Then
          .TextFrame.TextRange.Characters(x, 1).Font.Underline = False
        End If
      Next
    End If
    End If
    End With
End Sub

Function IsDescender(sCharacter As String) As Boolean
    Dim sDescenders as String
    sDescenders = "gjpqy"
    If InStr(sDescenders, sCharacter) > 0 Then
        IsDescender = True
    Else
        IsDescender = False
    End If
End Function

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

Remove underlines from descenders
http://www.pptfaq.com/FAQ01171-Remove-underlines-from-descenders.htm
Last update 14 December, 2019
Created: 20 April, 2013