ghet
ghet

Reputation: 279

Invalid word list returned by Word

In an Word addin, I'm using

this.Application.ActiveDocument.Words;

to get a list of all the words in the curret document. Now when I parse this list, I found the ,, . and \r are also in this list. Why is Word considering these words? I also looked at the word count in the status bar and that was wrong too, as for 7 words in my document the status bar shows 9 words.

Upvotes: 1

Views: 159

Answers (1)

Beth
Beth

Reputation: 9617

Looks like it's a feature.

from: here

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

also found:

If SingleWord < "A" Or SingleWord > "z" Then SingleWord = "" 'Out of range?

here

which says to me you can exclude punctuation from your set by testing for 'words' less than A or greater than z.

Upvotes: 3

Related Questions