PowerPoint 宏:批量调整图片大小
在 PowerPoint 中,可以使用以下宏来指定图片大小:
Sub ResizeImages()
Dim pic As Shape
Dim width As Long
Dim height As Long
' 设置图片的宽度和高度
width = 400
height = 300
For Each pic In ActivePresentation.Slides(1).Shapes
If pic.Type = msoPicture Then
pic.LockAspectRatio = msoFalse
pic.Width = width
pic.Height = height
End If
Next pic
End Sub
在此宏中,宽度和高度分别设置为 400 和 300 像素。您可以根据需要更改这些值。此宏还仅适用于幻灯片的第一个幻灯片。如果您需要在多个幻灯片上更改图像大小,请修改此宏,例如循环遍历所有幻灯片:
Sub ResizeImages()
Dim pic As Shape
Dim width As Long
Dim height As Long
' 设置图片的宽度和高度
width = 400
height = 300
' 遍历所有幻灯片
For Each slide In ActivePresentation.Slides
' 遍历每个幻灯片上的形状
For Each pic In slide.Shapes
If pic.Type = msoPicture Then
pic.LockAspectRatio = msoFalse
pic.Width = width
pic.Height = height
End If
Next pic
Next slide
End Sub
原文地址: https://www.cveoy.top/t/topic/mIw8 著作权归作者所有。请勿转载和采集!