1.使用方法:开发工具/宏/运行。如下图所示。2.VBA源码Sub 图片调整为相同大小()Dim oPPT As PresentationDim oSlide As SlideDim oCL As CustomLayoutDim oP As ShapeDim a, b, c, d, a1, b1, c1, d1, i As Doublea = 0: b = 0'当前ppt演示文稿Set oPPT = PowerPoint.ActivePresentationWith oPPT'遍历每一个幻灯片For Each oSlide In .SlidesWith oSlide'遍历每一个图形i = 1For Each oP In .ShapesWith oP.LockAspectRatio = msoFalsesName = .NameiType = .Type'统一调整每个图片的尺寸大小If i = 1 Then .Left = 100: .Top = 15If i = 2 Then .Left = 500: .Top = 15If i = 3 Then .Left = 100: .Top = 280If i = 4 Then .Left = 500: .Top = 280.Width = 300 * 1.25.Height = 250End Withi = i + 1NextEnd WithNextEnd WithEnd Sub}
以下是一段VBA代码,它可以实现将Microsoft Word文档中的所有图片尺寸统一为指定的高度和宽度:Sub ResizeAllImages()
Dim shp As Shape
For Each shp In ActiveDocument.Shapes
If shp.Type = msoPicture Then
shp.Height = Application.InchesToPoints(2)
shp.Width = Application.InchesToPoints(3)
End If
Next shp
End Sub
}