DocumentBase.Characters Property

Gets a Characters collection that represents the characters in the document.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Public ReadOnly Property Characters As Characters
public Characters Characters { get; }

Property Value

Type: Microsoft.Office.Interop.Word.Characters
A Characters collection that represents the characters in the document.

Examples

The following code example adds text to the first paragraph and then shows a message box that displays the total number of characters in the document. To use this example, run it from the ThisDocument class in a document-level project.

Private Sub DocumentCharacters()
        Me.Paragraphs(1).Range.InsertParagraphAfter()
        Me.Paragraphs(1).Range.Text = "This is sample text."
        MessageBox.Show("Total characters in document: " & Me.Characters.Count)
    End Sub
private void DocumentCharacters()
{
    this.Paragraphs[1].Range.InsertParagraphAfter();
    this.Paragraphs[1].Range.Text = "This is sample text.";
    MessageBox.Show("Total characters in document: " + this.Characters.Count);
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace