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

Add "leader" lines to tabbed text

Problem

In many word processing and desktop publishing programs, you can add "leader lines" in place of tabs.

For example, instead of

Age     42

you'd have

Age ..... 42

Solution

PowerPoint doesn't do leader lines.

One workaround is to create the text in Word, then copy/paste it into PowerPoint.

Another is to use this macro. It assumes that you have text like this:

Text [tab] Text
Text [tab] Text
Text [tab] Text

or

Text [tab] Text [tab] Text [tab] Text
Text [tab] Text [tab] Text [tab] Text
Text [tab] Text [tab] Text [tab] Text

and want leader lines in place of the first tab and every ODD numbered tab following that.

Select the text then run this:

Sub LeaderLines()

    Dim oSh As Shape
    Dim oRng As TextRange
    Dim oSld As Slide
    Dim x As Long
    Dim oLine As Shape
    Dim TabInstance As Long
    Dim LineCounter As Long

    Set oSh = ActiveWindow.Selection.ShapeRange(1)
    Set oRng = oSh.TextFrame.TextRange
    Set oSld = oSh.Parent

    With oRng
        For LineCounter = 1 To .Lines.Count
            With .Lines(LineCounter)
                TabInstance = 0
                For x = 1 To .Characters.Count
                    If .Characters(x) = vbTab Then
                        TabInstance = TabInstance + 1
                        If IsOdd(TabInstance) Then
                            With .Characters(x)
                                Set oLine = oSld.Shapes.AddLine(.BoundLeft, _
                                .BoundTop + .Boundheight, _
                                .BoundLeft + .Boundwidth, _
                                .BoundTop + .Boundheight)
                                With oLine
                                    .Fill.Transparency = 0#
                                    .Line.Weight = 3#
                                    .Line.DashStyle = msoLineRoundDot
                                End With
                            End With
                        End If
                    End If
                Next
            End With
        Next    ' line
    End With

End Sub

Function IsOdd(lInput As Long) As Boolean
    If lInput \ 2 = lInput / 2 Then
        IsOdd = False
    Else
        IsOdd = True
    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 - 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

Add "leader" lines to tabbed text
http://www.pptfaq.com/FAQ01011_Add_-leader-_lines_to_tabbed_text.htm
Last update 07 June, 2011
Created: