该属性返回一个 Range 对象,该对象代表指定文本框中的文本。
expression.TextRange
expression 必需。该表达式返回一个 TextFrame 对象。
本示例在活动文档中添加一个文本框,然后在文本框中添加文字。
Set myTBox = ActiveDocument.Shapes _
.AddTextBox(Orientation:=msoTextOrientationHorizontal, _
Left:=100, Top:=100, Width:=300, Height:=200)
myTBox.TextFrame.TextRange = "Test Box"
本示例在活动文档的“文本框 1”中添加文字。
ActiveDocument.Shapes("TextBox 1").TextFrame.TextRange _
.InsertAfter("New Text")
本示例返回活动文档的“文本框 1”中的文字,并显示在消息框中。
MsgBox ActiveDocument.Shapes("TextBox 1").TextFrame.TextRange.Text