Selection 属性 (Word)Selection.Words property (Word)

返回一个**Words** 集合, 该集合代表选定内容中的所有单词。Returns a Words collection that represents all the words in a selection. 此为只读属性。Read-only.

语法Syntax

expressionexpression. Words

_表达式_一个代表**Selection** 对象的变量。expression A variable that represents a Selection object.

备注Remarks

文档中的标点符号和段落标记包括在**Words** 集合中。Punctuation and paragraph marks in a document are included in the Words collection. 有关返回集合中单个成员的信息, 请参阅返回集合中的对象For information about returning a single member of a collection, see Returning an object from a collection.

示例Example

本示例显示选定内容的字数。This example displays the number of words in the selection. 段落标记、部分单词和标点符号都统计在内。Paragraphs marks, partial words, and punctuation are included in the count.

MsgBox "There are " & Selection.Words.Count & " words."

另请参阅See also

Selection 对象Selection Object

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.