I have a PowerPoint file with a slide with an image (wmf/emp file) in it and I want to "ungroup" the image elements in it using VBA.
I need to ask PowerPoint twice to do it - but then it does.
Can it be done using VBA? and if so, how?
I have a PowerPoint file with a slide with an image (wmf/emp file) in it and I want to "ungroup" the image elements in it using VBA.
I need to ask PowerPoint twice to do it - but then it does.
Can it be done using VBA? and if so, how?
It's fairly simple - from the help file:
This example ungroups any grouped shapes and disassembles any pictures or OLE objects on 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 can't be ungrouped, like a JPG, and some type checking (i.e. If s.Type = msoPicture...
)
Not a direct answer to the question but...
The single best way to figure out how to automate office applications with VBA is to record a macro and then look at the code that gets spit out.