Any VBA code to align an image from PowerPoint?

I have a PowerPoint document with 239 slides. I need to align an image from each slide by following these two steps:

1. Right click and select "Edit Image"

2. Then press YES

enter image description here

enter image description here

My question is: Is there any macro (vba code) to do this whole job automatically? Thank you!

+1


a source to share


1 answer


Microsoft stores complex vector objects in WMF or EMF formats and must be converted to native MSO drawing objects (vectors) to edit them. The process for this is to ungroup them, and this code will do that for your entire presentation:

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

      



You can ungroup a second time if you need / need.

+2


a source







All Articles