![使 Powerpoint 演示文稿幻灯片中的图像具有相同的大小、轮廓和位置](https://linux22.com/image/1534169/%E4%BD%BF%20Powerpoint%20%E6%BC%94%E7%A4%BA%E6%96%87%E7%A8%BF%E5%B9%BB%E7%81%AF%E7%89%87%E4%B8%AD%E7%9A%84%E5%9B%BE%E5%83%8F%E5%85%B7%E6%9C%89%E7%9B%B8%E5%90%8C%E7%9A%84%E5%A4%A7%E5%B0%8F%E3%80%81%E8%BD%AE%E5%BB%93%E5%92%8C%E4%BD%8D%E7%BD%AE.png)
我有一张幻灯片,每天都会更新图片,但其他用户添加的图片通常都是错的。这意味着我必须调整大小、重新定位并添加轮廓,以满足这些演示文稿的定义标准。
我找到了一个宏,可以让我根据选择调整所有图像的大小
Sub Imagesize
Dim oshp As Shape
Dim oPic As Shape
Dim picH As Single
Dim picW As Single
Dim osld As Slide
If ActiveWindow.Selection.Type = ppSelectionNone Then GoTo err
If ActiveWindow.Selection.ShapeRange.Count <> 1 Then GoTo err
Set oshp = ActiveWindow.Selection.ShapeRange(1)
For Each osld In ActivePresentation.Slides
For Each oPic In osld.Shapes
If oPic.Type = msoPicture Then
picW = oPic.Width
picH = oPic.Height
oPic.LockAspectRatio = True
oPic.Width = oshp.Width
oPic.Left = oPic.Left - (oshp.Width - picW) / 2
oPic.Top = oPic.Top - (oshp.Height - picH) / 2
End If
If oPic.Type = msoPlaceholder Then
If oPic.PlaceholderFormat.ContainedType = msoPicture Then
picW = oPic.Width
picH = oPic.Height
oPic.LockAspectRatio = True
oPic.Width = oshp.Width
oPic.Left = oPic.Left - (oshp.Width - picW) / 2
oPic.Top = oPic.Top - (oshp.Height - picH) / 2
End If
End If
Next oPic
Next osld
Exit Sub
err:
MsgBox "Please select ONE shape and retry!", vbCritical
End Sub
它运行完美,但有人知道是否可以添加任何东西来使图像位于水平 19 厘米和垂直 4 厘米处?