TextRange2.Lines Property (Office)

Returns a TextRange2 object that represents the specified subset of text lines. Read-only.

Syntax

expression .Lines(Start, Length)

expression An expression that returns a TextRange2 object.

Parameters

Name

Required/Optional

Data Type

Description

Start

Optional

Long

The first line in the returned range.

Length

Optional

Long

The number of lines to be returned.

Return Value

TextRange2

Remarks

If both Start and Length are omitted, the returned range starts with the first line and ends with the last paragraph in the specified range.

If Start is specified but Length is omitted, the returned range contains one line.

If Length is specified but Start is omitted, the returned range starts with the first line in the specified range.

If Start is greater than the number of lines in the specified text, the returned range starts with the last line in the specified range.

If Length is greater than the number of lines from the specified starting line to the end of the text, the returned range contains all those lines.

Example

This example formats as italic the first two lines of the second paragraph in shape two on slide one in the active PowerPoint presentation.

Application.ActivePresentation.Slides(1).Shapes(2) _ 
 .TextFrame.TextRange2.Paragraphs(2) _ 
 .Lines(1, 2).Font.Italic = True 

See Also

Concepts

TextRange2 Object

TextRange2 Object Members