我想創建一個代碼,它將調整所選圖像的大小,相應地放置它,在它下面創建2個文本框,最後將圖像和2個文本框分組在一起。VBA Powerpoint分組數組?
我的總體目標是製作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
完美!非常感謝!! :) – DaniDarko