使 Powerpoint 演示文稿幻灯片中的图像具有相同的大小、轮廓和位置

使 Powerpoint 演示文稿幻灯片中的图像具有相同的大小、轮廓和位置

我有一张幻灯片,每天都会更新图片,但其他用户添加的图片通常都是错的。这意味着我必须调整大小、重新定位并添加轮廓,以满足这些演示文稿的定义标准。

我找到了一个宏,可以让我根据选择调整所有图像的大小

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 厘米处?

相关内容