任何 VBA 代码来对齐 PowerPoint 中的图片?

Any VBA code to align the picture from PowerPoint?

我有一个包含 239 张幻灯片的 PowerPoint 文档。我必须通过以下两个步骤对齐每张幻灯片中的图片:

1.右击select编辑图片

2. 然后按 YES

我的问题:是否有任何宏(vba代码)可以自动完成所有这些工作? 谢谢!

Microsoft 以 WMF 或 EMF 格式存储复杂的矢量对象,为了编辑它们,需要将它们转换为本机 MSO 绘图对象(矢量)。执行此操作的过程是将它们取消组合,此代码将为您的整个演示文稿执行此操作:

Option Explicit

' ===================================================================
' Purpose : Loop through each shape of each slide in a presentation
'           and ungroup and WMF files, thereby converting them to
'           MSO drawing objects that can be edited.
' Author  : Jamie at YOUpresent Ltd. http://youpresent.co.uk/
' ===================================================================
Sub ConvertAllMetafilePicturestoGroups()
  Dim oSld As Slide
  Dim oShp As Shape
  For Each oSld In ActivePresentation.Slides
    For Each oShp In oSld.Shapes
      On Error Resume Next ' In case picture is a bitmap and not a WMF vector
      If oShp.Type = msoPicture Then oShp.Ungroup
      On Error GoTo 0
    Next
  Next
  ' Clean up
  Set oShp = Nothing: Set oSld = Nothing
End Sub

如果want/need取消组合,您可以再次取消组合。