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.