Document.Words Property (2007 System)

Gets a Words collection that represents all the words 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 Words As Words
'Usage
Dim instance As Document 
Dim value As Words 

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

Property Value

Type: Words
A Words collection that represents all the words in the document.

Remarks

Punctuation and paragraph marks in a document are included in the Words collection.

Examples

The following code example adds a line of text to the document and then uses the Words property to set the color of the first word in the document to blue.

This example is for a document-level customization.

Private Sub DocumentWords()
    Dim start As Object = 0
    Dim [end] As Object = 0
    Dim range1 As Word.Range = Me.Range(start, [end])
    range1.Text = "This is the first sentence in the document." 

    Me.Words.First.Font.Color = Word.WdColor.wdColorBlue
End Sub
private void DocumentWords()
{
    object start = 0;
    object end = 0;
    Word.Range range1 = this.Range(ref start, ref end);
    range1.Text = "This is the first sentence in the document.";

    this.Words.First.Font.Color = Word.WdColor.wdColorBlue;
}

.NET Framework Security

See Also

Reference

Document Class

Document Members

Microsoft.Office.Tools.Word Namespace