Share via


Document.Characters Property (2007 System)

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

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

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property Characters As Characters
'Usage
Dim instance As Document 
Dim value As Characters 

value = instance.Characters
[BrowsableAttribute(false)]
public Characters Characters { get; }
[BrowsableAttribute(false)]
public:
property Characters^ Characters {
    Characters^ get ();
}
public function get Characters () : Characters

Property Value

Type: 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.

This example is for a document-level customization.

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

Document Class

Document Members

Microsoft.Office.Tools.Word Namespace