Shapes (Shape)![]() ![]() ![]() |
代表 Shape 对象中的文本框。包含文本框中的文字,也包含用于控制文本框的对齐方式及位置的属性和方法。
可用 TextFrame 属性返回 TextFrame 对象。下例向 myDocument
添加矩形,并向矩形添加文本框,然后设置文本框的边距。
Set myDocument = Worksheets(1)
With myDocument.Shapes.AddShape(msoShapeRectangle, _
0, 0, 250, 140).TextFrame
.Characters.Text = "Here is some test text"
.MarginBottom = 10
.MarginLeft = 10
.MarginRight = 10
.MarginTop = 10
End With