Class TabStop (Word VBA)

The class TabStop represents a single tab stop. The TabStop object is a member of the TabStops collection. The TabStops collection represents all the custom and default tab stops in a paragraph or group of paragraphs.

The main procedure of class TabStop is TabStops.Add


To use a TabStop class variable it first needs to be instantiated, for example

Dim tsp as TabStop
Set tsp = ActiveDocument.Paragraphs(1).TabStops(Index:=1)

The following procedures can be used to set variables of type TabStop: Next, Previous, TabStops.Add, TabStops.Item, TabStops.After, TabStops.Before, Paragraph.TabStops, ParagraphFormat.TabStops and Paragraphs.TabStops

For Each

Here is an example of processing the TabStop items in a collection.

Dim ts As TabStop 
For each ts in ActiveDocument.Paragraphs(1).TabStops 
 If ts.CustomTab = True Then 
 ts.Alignment = wdAlignTabLeft 
 End If 
Next ts


This is the main method of the TabStop class

TabStops.Add - Returns a TabStop object that represents a custom tab stop added to a document.

Dim tsp As TabStop
Set tsp = ActiveDocument.Lists(1).ListParagraphs(1).TabStops.Add(Position:=)


Alignment returns or sets a WdTabAlignment constant that represents the alignment for the specified tab stop.

ActiveDocument.Lists(1).ListParagraphs(1).TabStops(1).Alignment = wdAlignTabBar

CustomTab true if the specified tab stop is a custom tab stop.

Dim booCustomTab As Boolean
booCustomTab = ActiveDocument.Lists(1).ListParagraphs(1).TabStops(1).CustomTab

Leader returns or sets the leader for the specified TabStop object.

ActiveDocument.Lists(1).ListParagraphs(1).TabStops(1).Leader = wdTabLeaderDashes

Next returns the next tabstop in the collection.

Dim tspNext As TabStop
Set tspNext = ActiveDocument.Lists(1).ListParagraphs(1).TabStops(1).Next

Parent returns an object that represents the parent object of the specified TabStop object.

Dim objParent As Object
Set objParent = ActiveDocument.Lists(1).ListParagraphs(1).TabStops(1).Parent

Position returns or sets the position of a tab stop relative to the left margin.

ActiveDocument.Lists(1).ListParagraphs(1).TabStops(1).Position =

Previous returns the previous tab stop in the collection.

Dim tspPrevious As TabStop
Set tspPrevious = ActiveDocument.Lists(1).ListParagraphs(1).TabStops(1).Previous

TabStops.Count returns a Long that represents the number of tab stops in the collection.

Dim lngCount As Long
lngCount = ActiveDocument.Lists(1).ListParagraphs(1).TabStops.Count

TabStops.Parent returns an object that represents the parent object of the specified TabStops object.

Dim objParent As Object
Set objParent = ActiveDocument.Lists(1).ListParagraphs(1).TabStops.Parent