选择。 Expand 方法 (Word)Selection.Expand method (Word)

扩展指定的区域或所选内容。Expands the specified range or selection. 返回添至该区域或所选内容的字符数。Returns the number of characters added to the range or selection. Long.

语法Syntax

expressionexpression. Expand( _Unit_ )

expression:必需。expression Required. 表示 Selection 对象的变量。A variable that represents a Selection object.

参数Parameters

名称Name 必需/可选Required/Optional 数据类型Data type 说明Description
UnitUnit 可选Optional VariantVariant 一个**** 常量, 该常量代表要扩展区域的单位。A WdUnits constant that represents the unit by which to expand the range. 默认值是 wdWordThe default value is wdWord.

示例Example

本示例先将选定内容的首个字符设为大写,再将选定内容扩展至整句。This example capitalizes the first character in the selection and then expands the selection to include the entire sentence.

With Selection 
 .Characters(1).Case = wdTitleSentence 
 .Expand Unit:=wdSentence 
End With

另请参阅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.