Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
290140 How to run the sample code for the Office XP programs from Knowledge Base articles
The
Words property returns a collection that represents all the words in a range, selection, or document. The collection includes all punctuation and paragraph marks in the selection or the document.
For example, if you attempt to determine the word count in the following three lines of text
This is x number of words.
This is x number of words.
This is x number of words.
by using the
Words property as follows
Sub GetWords()
MsgBox ActiveDocument.Words.Count
End Sub
the result is 24 words.