How do you "ungroup" an image in PowerPoint using VBA

I have a PowerPoint file with an image slide (wmf / emp file) in it and I want to "ungroup" the image elements in it using VBA.

I need to ask PowerPoint to do this twice, but then it happens.

Can this be done with VBA? And if so, how?

+2


a source to share


2 answers


It's pretty simple - from the help file:

This example ungroups any grouped shape and disassembles any images or OLE objects in myDocument.

Set myDocument = ActivePresentation.Slides(1)
For Each s In myDocument.Shapes
    s.Ungroup
Next

      



You may need to do some error checking if it cannot be ungrouped like JPG and some type checking (i.e. If s.Type = msoPicture...

)

+4


a source


Not a direct answer to the question, but ...



The best way to figure out how to automate office applications with VBA is to record a macro and then watch the code spit out .

+1


a source







All Articles