本示例在 myDocument 中添加一个矩形,在矩形中添加文本,并为文字框架添加边距。

Set myDocument = ActiveDocument
With myDocument.Shapes.AddShape(ksoShapeRectangle, _
    0, 0, 250, 140).TextFrame
    .TextRange.Text = "Here is some test text"
    .MarginBottom = 0
    .MarginLeft = 100
    .MarginRight = 0
    .MarginTop = 20
End With