PDA

View Full Version : Macro to ungroup all EMF images in a presentation ?



somedude
10-23-2016, 11:07 AM
Hi,

I'm using icons that I exported from Illustrator to .emf

Is there a way to ungroup all such icons in a given presentation, instead of doing it manually ?

Thanks in advance.

Paul_Hossler
10-23-2016, 02:07 PM
post a small sample presentation with some in for testing

somedude
10-23-2016, 09:31 PM
Here you go 17396

Paul_Hossler
10-25-2016, 07:03 AM
Very similar to the other Slides / Shape loop macro

1. Since we're adding additional Shapes to the Shapes collection by .Ungroup, I needed to remember the original msoPicture shapes

2. Since not all msoPicture shapes seem to be .Ungroup-able, I added On Error Resume Next

3. There might be a more cleverer way, but I'm not very good with the PP object model


17401





Option ExplicitSub UnGroupEMF()

Dim oPres As Presentation
Dim oSlide As Slide
Dim oShape As Shape
Dim aShapes(1 To 100) As Shape
Dim iShapes As Long, i As Long

Set oPres = ActivePresentation

For Each oSlide In oPres.Slides

'need to remember the original images since we will be 'adding' more shapes
iShapes = 0

For Each oShape In oSlide.Shapes
If oShape.Type = msoPicture Then
iShapes = iShapes + 1
Set aShapes(iShapes) = oShape
End If
Next

For i = 1 To iShapes
'not all msoPicture can be Ungroup-ed
On Error Resume Next
aShapes(i).Ungroup
On Error GoTo 0
Next
Next
End Sub