Spacing Property

Microsoft Word Visual Basic

Spacing Property

       

Returns or sets the spacing (in points) between characters (for the Font object), between the cells in a table (for the Table object), or between columns (for the TextColumns object). Read/write Single.

expression.Spacing

expression   Required. An expression that returns one of the objects in the Applies To list.

Remarks

After this property has been set for a TextColumns object, the EvenlySpaced property is set to True. To return or set the spacing for a single text column when EvenlySpaced is False, use the SpaceAfter property of the TextColumn object.

Example

This example demonstrates two different character spacings at the beginning of the active document.

Set myRange = ActiveDocument.Range(Start:=0, End:=0)
With myRange
    .InsertAfter "Demonstration of no character spacing."
    .InsertParagraphAfter
    .InsertAfter "Demonstration of character spacing (1.5pt)."
    .InsertParagraphAfter
End With
ActiveDocument.Paragraphs(2).Range.Font.Spacing = 1.5

This example sets the character spacing of the selected text to 2 points.

If Selection.Type = wdSelectionNormal Then
    Selection.Font.Spacing = 2
Else
    MsgBox "You need to select some text."
End If

This example sets the spacing between cells in the first table in the active document to nine points.

ActiveDocument.Tables(1).Spacing = 9

This example formats the active document to display text in two columns with 0.5 inch (36 points) spacing between the columns.

With ActiveDocument.PageSetup.TextColumns
    .SetCount NumColumns:=2
    .LineBetween = False
    .EvenlySpaced = True
    .Spacing = 36
End With