Table of contents
TOC
Collapse the table of content
Expand the table of content

TextRange.Length Property (Publisher)

office 365 dev account|Last Updated: 8/24/2017
|
3 Contributors

Returns a Long value indicating the length of the specified text range, in characters. Read-only.

Syntax

expression. Length

_expression_A variable that represents a TextRange object.

Example

This example sets the font size of a text frame on page two to 48 points if the text frame contains more than five characters, or it sets the font size to 72 points if the text frame has five or fewer characters.

With ActiveDocument.Pages(2).Shapes(1) _ 
 .TextFrame.TextRange 
 If .Length > 5 Then 
 .Font.Size = 48 
 Else 
 .Font.Size = 72 
 End If 
End With
© 2018 Microsoft