Mary Lou in PA said:
We are using Word 2007, and I think I copy/pasted the code correctly.
Hope
this helps. Thanks
Sub Dotleader()
'
' Dotleader Macro
'
'
Selection.Font.Bold = wdToggle
With Selection.ParagraphFormat
.LeftIndent = InchesToPoints(0)
.RightIndent = InchesToPoints(0)
.SpaceBefore = 0
.SpaceBeforeAuto = False
.SpaceAfter = 0
.SpaceAfterAuto = False
.LineSpacingRule = wdLineSpaceSingle
.Alignment = wdAlignParagraphJustify
.WidowControl = True
.KeepWithNext = False
.KeepTogether = False
.PageBreakBefore = False
.NoLineNumber = False
.Hyphenation = True
.FirstLineIndent = InchesToPoints(0)
.OutlineLevel = wdOutlineLevelBodyText
.CharacterUnitLeftIndent = 0
.CharacterUnitRightIndent = 0
.CharacterUnitFirstLineIndent = 0
.LineUnitBefore = 0
.LineUnitAfter = 0
.MirrorIndents = False
.TextboxTightWrap = wdTightNone
End With
These lines of code are irrelevant for setting tab stops. As you may know,
this is a common side-effect of the macro recorder.
Selection.ParagraphFormat.TabStops.ClearAll
ActiveDocument.DefaultTabStop = InchesToPoints(0.5)
Selection.ParagraphFormat.TabStops.Add Position:=InchesToPoints(6.75),
_
Alignment:=wdAlignTabRight, Leader:=wdTabLeaderDots
Selection.TypeText Text:=vbTab
End Sub
The code above clears all existing tab stops, then sets a value for the
default tab stops. A custom tab stop is added at 6.75" from the left margin,
and the type is set to right-aligned with a dot leader. Finally, a tab
character is added. This seems pretty much what I found when I tested this.
In what way does this code fail for you?
--
Stefan Blom
Microsoft Word MVP