[英]VBA powerpoint: Size and align 2 images on one slide
I am trying to get two pictures to resize and align side by side...think like a before and after comparison on one slide. 我正在尝试获取两张图片以调整大小并排对齐...就像在一张幻灯片上进行比较之前和之后一样。 The pictures are already imported to the slide.
图片已导入到幻灯片。 I have two macros written, one for the left one for the right, based on the selected shape but was looking to combine to one.
我根据选定的形状编写了两个宏,一个用于左边,一个用于右边,但希望将其组合为一个。
Here is what I have (rookie) to combine 这是我要结合的(菜鸟)
'Updated Macro
Sub SidebySide()
Dim oSp As Shape
Dim oSld As Slide
If CheckIsPic(oSp) = True Then
With oSp
Do
.Height = (5.6 * 72)
.Width = (4.8 * 72)
.Left = (0.2 * 72)
.Top = (1.3 * 72)
Loop While oSp = ActiveWindow.Selection.ShapeRange(1)
End With
With oSp
Do
.Height = (5.6 * 72)
.Width = (4.8 * 72)
.Left = (5# * 72)
.Top = (1.3 * 72)
Loop While oSp <> ActiveWindow.Selection.ShapeRange(1)
End With
End If
End Sub
Function CheckIsPic(oSp As Shape) As Boolean
If oSp.Type = msoPicture Then CheckIsPic = True
End If
End Function
It is not running so I know I probably have something wrong in there, but essentially I am trying to run a loop if it is a pic on the slide...do A to the selection, do B to the non selection. 它没有运行,所以我知道我那里可能有问题,但是本质上,如果幻灯片上有图片,我想尝试运行一个循环...对选择项执行A,对非选择项执行B。
Any ideas? 有任何想法吗? I am sure there is a much better way to go about this.
我相信有更好的方法来解决这个问题。 Thanks
谢谢
I think that moving the With
OUTSIDE the Do...Loop
will solve the issue. 我认为移动
With
Without the Do...Loop
将解决此问题。 (do it twice) (做两次)
With oSp
Do
.Height = (5.6 * 72)
.Width = (4.8 * 72)
.Left = (0.2 * 72)
.Top = (1.3 * 72)
Loop While oSp = ActiveWindow.Selection.ShapeRange(1)
End With
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.