Last Property

Microsoft Word Visual Basic

Show All

Last Property

       

Last property as it applies to the Columns object.

Returns the last item in the Columns collection as a Column object. 

expression.Last

expression   Required. An expression that returns a Columns object.

Last property as it applies to the Paragraphs object.

Returns the last item in the Paragraphs collection as a Paragraph object.

expression.Last

expression   Required. An expression that returns a Paragraphs object.

Last property as it applies to the Characters, Sentences, and Words objects.

Returns a Range object that represents the last character, word, or sentence in a document, selection, or range.

expression.Last

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

Last property as it applies to the Rows object.

Returns the last item in the Rows collection as a Row object.

expression.Last

expression   Required. An expression that returns a Rows object.

Last property as it applies to the Sections object.

Returns the last item in the Sections collection as a Section object.

expression.Last

expression   Required. An expression that returns a Sections object.

Example

As it applies to the Paragraphs object.

This example formats the last paragraph in the active document to be right-aligned.

ActiveDocument.Paragraphs.Last.Alignment = wdAlignParagraphRight

As it applies to the Words object.

This example applies bold formatting to the last word in the selection.

If Selection.Words.Count >= 2 Then
    Selection.Words.Last.Bold = True
End If

As it applies to the Rows object.

This example deletes the last row in table one.

ActiveDocument.Tables(1).Rows.Last.Cells.Delete