Share via


Range.StoryLength Property

Word Developer Reference

Returns the number of characters in the story that contains the specified range. Read-only Long.

Syntax

expression.StoryLength

expression   A variable that represents a Range object.

Example

This example determines whether the header in the active document is empty. If the header story is not empty, a message box displays the contents of the header. If the document header is empty, StoryLength returns 1 for the final paragraph mark.

Visual Basic for Applications
  Set myRange = ActiveDocument.Sections(1) _
    .Headers(wdHeaderFooterPrimary).Range
If myRange.StoryLength > 1 Then MsgBox myRange.Text

This example closes the document without saving changes, if it is empty.

Visual Basic for Applications
  If ActiveDocument.Content.StoryLength = 1 Then _
    ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges

See Also