Words Interface

Definition

A collection of words in a selection, range, or document.

public interface class Words : System::Collections::IEnumerable
[System.Runtime.InteropServices.Guid("0002095C-0000-0000-C000-000000000046")]
public interface Words : System.Collections.IEnumerable
type Words = interface
    interface IEnumerable
Public Interface Words
Implements IEnumerable
Attributes
Implements

Remarks

Each item in the Words collection is a Range object that represents one word. There is no Word object.

Use the Words property to return the Words object.

Use Words(index), where index is the index number, to return a Range object that represents one word. The index number represents the position of the word in the Words collection.

The item in the Words collection includes both the word and the spaces after the word. If the selection is the insertion point and it is immediately followed by a space, Selection.Words(1) refers to the word preceding the selection. If the selection is the insertion point and is immediately followed by a character, Selection.Words(1) refers to the word following the selection.

The Count property for this collection in a document returns the number of items in the main story only. To count items in other stories use the collection with the Range object. Also, the Count property includes punctuation and paragraph marks in the total. If you need a count of the actual words in a document, use the Word Count dialog box.

The Add method isn't available for the Words collection. Instead, use the InsertAfter(String) method or the InsertBefore(String) method to add text to a Range object.

Properties

Application

Returns a Application object that represents the Microsoft Word application.

Count

Returns the number of items in the specified collection.

Creator

Returns a 32-bit integer that indicates the application in which the specified object was created.

First

Returns a Range object that represents the first word in a document, selection or range.

Item[Int32]

Returns an individual object in a collection.

Last

Returns a Range object that represents the last word in a document, selection, or range.

Parent

Returns an object that represents the parent object of the specified object.

Methods

GetEnumerator()

Applies to