StoryLength Property
Applies To
Range object, Selection object.
Description
Returns the number of characters in the story that contains the specified range or selection. Read-only Long.
See Also
End property, Start property, StoryType property.
Example
This example determines whether the header in the active document is empty. If the header story isn't empty, a message box displays the contents of the header. If the document header is empty, StoryLength returns 1 for the final paragraph mark.
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's empty.
If ActiveDocument.Content.StoryLength = 1 Then _
ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges