VerticalAlignment Property

Applies To

Cell object, Cells collection object, PageSetup object.

Description

Returns or sets the vertical alignment of text on each page in a document or section, or in one or more cells of a table. Can be one of the following WdVerticalAlignment constants: wdAlignVerticalBottom, wdAlignVerticalCenter, wdAlignVerticalJustify, or wdAlignVerticalTop. Read/write Long.

See Also

Alignment property.

Example

This example changes the vertical alignment of the first document so that the text is centered between the top and bottom margins.

Documents(1).PageSetup.VerticalAlignment = wdAlignVerticalCenter
This example creates a new document and then inserts the same paragraph 10 times. The vertical alignment of the new document is then set so that the 10 paragraphs are equally spaced (justified) between the top and bottom margins.

Set myDoc = Documents.Add
With myDoc.Content
    For i = 1 to 9
        .InsertAfter "This is a sentence."
        .InsertParagraphAfter
    Next i
    .InsertAfter "This is a sentence."
End With
myDoc.PageSetup.VerticalAlignment = wdAlignVerticalJustify
This example creates a 3x3 table in a new document and assigns a sequential cell number to each cell in the table. The example then sets the height of the first row to 20 points and vertically aligns the text at the top of the cells.

Set newDoc = Documents.Add
Set myTable = newDoc.Tables.Add(Selection.Range, 3, 3)
i = 1
For Each c In myTable.Range.Cells
    c.Range.InsertAfter "Cell " & i
    i = i + 1
Next
With myTable.Rows(1)
    .Height = 20
    .Cells.VerticalAlignment = wdAlignVerticalTop
End With