在 powerpoint 中创建插入图形的位置

Create the position of an inserted graph in powerpoint

我正在尝试编写 VBA 可以重现以下形状的代码:

我写了一段可以创建形状的代码:

Sub InsertShape()

Set myDocument = ActivePresentation.Slides(1)
myDocument.Shapes.AddShape Type:=msoShapeChevron, _
    Left:=50, Top:=50, Width:=100, Height:=200


End Sub

但是现在我正在寻找一种方法来调整宽度和高度并将其移动到特定位置。如果我单击形状(请参阅突出显示的区域),我会看到目标形状具有以下值:

身高:6:51 有:7,07

水平位置:11,16 垂直位置:4,52

关于我应该添加到代码中的任何反馈,以便形状处于正确的位置(+ 正确的宽度和高度)。

使用.Height/.Width/.Left/.Top参数调整形状的大小和位置(注意数值以磅为单位;28.35points/cm或72points/inch ).

使用形状的 .Adjustments(1) 属性 修改形状的特征。从大约 .2 的值开始以获得您想要的那种形状。

Sub InsertShape()
' ALWAYS Dim your variables
Dim myDocument as Slide
Dim oSh as Shape

Set myDocument = ActivePresentation.Slides(1)
Set oSh = myDocument.Shapes.AddShape Type:=msoShapeChevron, _
    Left:=50, Top:=50, Width:=100, Height:=200
With oSh
   .Adjustments(1) = .2
   ' Change other shape properties here too if you wish
End With

End Sub