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.

Double-Underline text

Problem

Word does double-underlined text. Excel does double-underlined text. For all I know, Notepad may do it.

PowerPoint doesn't. Which is annoying.

This macro teaches PowerPoint how to give text a double underline.

Solution

The DoubleUnderline macro below will give selected text a double-underline.
You can change the value off dOffset to alter the distance between underlines.

Be sure to select some text first or it'll give you error messages instead.

The UnUnderline macro will remove underlines on the current slide.

Sub DoubleUnderline()

    Dim oRng As TextRange
    Dim lLineCount As Long
    Dim oLine As Shape
    Dim dOffset As Double

    dOffset = 4     ' space between underlines in points
                    ' change if you like

    With ActiveWindow.Selection.TextRange
        For lLineCount = 1 To .Lines.Count
            Set oRng = .Lines(lLineCount)
            With oRng
                Set oLine = ActiveWindow.Selection.SlideRange.Shapes.AddLine( _
                    .BoundLeft, .BoundTop + .Boundheight, _
                    .BoundLeft + .Boundwidth, .BoundTop + .Boundheight)
                Call oLine.Tags.Add("Underline", "YES")
                With oLine.Duplicate(1)
                    .Left = oLine.Left
                    .Top = oLine.Top + dOffset
                    Call .Tags.Add("Underline", "YES")
                End With
            End With
        Next
    End With

End Sub

Sub UnUnderline()
' Removes underlines added by DoubleUndies

    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("Underline") = "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

Double-Underline text
http://www.pptfaq.com/FAQ00775_Double-Underline_text_.htm
Last update 07 June, 2011
Created: