VerticalAlignment Property

Microsoft Word Visual Basic

Returns or sets the vertical alignment of text in one or more cells of a table. Read/write WdCellVerticalAlignment.

WdCellVerticalAlignment can be one of these WdCellVerticalAlignment constants.
wdCellAlignVerticalBottom
wdCellAlignVerticalCenter
wdCellAlignVerticalTop

expression.VerticalAlignment

expression    Required. An expression that returns one of the above objects.

ShowVerticalAlignment property as it applies to the PageSetup object.

Returns or sets the vertical alignment of text on each page in a document or section. Read/write WdVerticalAlignment.

WdVerticalAlignment can be one of these WdVerticalAlignment constants.
wdAlignVerticalBottom
wdAlignVerticalCenter
wdAlignVerticalJustify
wdAlignVerticalTop

expression.VerticalAlignment

expression    Required. An expression that returns a PageSetup object.

Example

ShowAs it applies to the Cell and Cells objects.

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
				

ShowAs it applies to the PageSetup object.

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