CreateTextbox 方法 (Word)Selection.CreateTextbox method (Word)

在选定内容周围添加一个默认大小的文本框。Adds a default-size text box around the selection.


expression.expression. CreateTextbox

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


如果所选内容是一个插入点,本方法将鼠标指针设为十字型指针,以便绘制一个文本框。If the selection is an insertion point, this method changes the pointer to a cross-hair pointer so that the user can draw a text box.

使用此方法等效于单击 "绘图" 工具栏上的 "文本框" 按钮。Using this method is equivalent to clicking the Text Box button on the Drawing toolbar. 文本框是一个具有关联文本框架的矩形。A text box is a rectangle with an associated text frame.


本示例在选定内容周围添加一个文本框,然后改变该文本框样式。This example adds a text box around the selection and then changes the text box's line style.

If Selection.Type = wdSelectionNormal Then 
 Selection.ShapeRange(1).Line.DashStyle =msoLineDashDot 
End If

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