我想创建一个代码来调整所选图像的大小,相应地定位它,在它下面创建 2 个文本框,最后将图像和 2 个文本框组合在一起。
我的总体目标是制作 2 个额外的宏,它们将执行相同的功能,但将它们定位在中间和右侧。
我似乎无法弄清楚如何对 3 个形状进行分组。
下面是我的代码。
Dim LeftPic As ShapeRange, sld As Slide, ByeBox As Shape, HelloBox As Shape
Set LeftPic = ActiveWindow.Selection.ShapeRange
Set sld = Application.ActiveWindow.View.Slide
With LeftPic
.Left = 0.17 * 72 '72 is the multiplier for the inch
.Top = 1.83 * 72
.Height = 4.27 * 72
.Width = 3.2 * 72
End With
LeftPic.Name = "LeftPic"
Set HelloBox = sld.Shapes.AddTextbox(msoTextOrientationHorizontal, _
0.17 * 72, Top:=6.17 * 72, Width:=200, Height:=50)
HelloBox.TextFrame.TextRange.Text = "Hello"
HelloBox.Name = "HelloBox"
Set ByeBox = sld.Shapes.AddTextbox(msoTextOrientationHorizontal, _
0.17 * 72, Top:=6.42 * 72, Width:=200, Height:=50)
ByeBox.TextFrame.TextRange.Text = "Goodbye"
ByeBox.Name = "ByeBox"
Shapes.Range(Array("HelloBox", "ByeBox", "LeftPic")).Group