Sub RevertPowerClipToShape() ActiveDocument.ReferencePoint = cdrCenter
Dim OrigSelection As ShapeRange Set OrigSelection = ActiveSelectionRange
Dim s As Shape
If ActiveSelectionRange.Count = 0 Then MsgBox "No shapes selected" Exit Sub Else For Each s In OrigSelection s.PowerClip.Shapes.All.Delete Next s End IfEnd Sub
this macro deletes the contents and keeps the container.Can someone change to do it the other way around please
This extracts the contents and deletes the container. It can work on multiple selected PowerClips.
Sub PowerClips_Extract_Contents_Delete_Frames() Dim sr As ShapeRange Dim s As Shape On Error GoTo ErrHandler If Not ActiveDocument Is Nothing Then Set sr = ActiveSelectionRange For Each s In sr If Not s.PowerClip Is Nothing Then s.PowerClip.ExtractShapes s.Delete End If Next s Else MsgBox "No document is active.", vbInformation, "PowerClips Extract Contents Delete Frames" End If ExitSub: Refresh Exit Sub ErrHandler: MsgBox "Error occurred: " & Err.Description & vbCrLf & vbCrLf & "PowerClips_Extract_Contents_Delete_Frames()" Resume ExitSub End Sub
the macro I mentioned, if the powerclip is inside another powerclip the container remains inside the first powerclip.is it possible to leave the content this way?
If I understand correctly, you are asking for a very specific capability. You want to find PowerClips that are "one level down" inside other PowerClips, then extract the contents and delete the frame - but keep the extracted contents inside the "top level" PowerClip.
Is somebody creating this difficult situation for you (i.e., giving you a file that has PowerClips-within-PowerClips)? Or are you creating this situation yourself while trying to accomplish some task?
You could try this:
Sub PowerClips_One_Level_Within_PowerClips_Extract_Contents_Delete_Frame() Dim sr As ShapeRange Dim s As Shape Dim sr2 As ShapeRange Dim s2 As Shape On Error GoTo ErrHandler ActiveDocument.BeginCommandGroup "foo" If Not ActiveDocument Is Nothing Then Set sr = ActiveSelectionRange For Each s In sr If Not s.PowerClip Is Nothing Then Set sr2 = s.PowerClip.Shapes.FindShapes(, , False) s.PowerClip.EnterEditMode For Each s2 In sr2 If Not s2.PowerClip Is Nothing Then s2.PowerClip.ExtractShapes s2.Delete End If Next s2 s.PowerClip.LeaveEditMode End If Next s Else MsgBox "No document is active.", vbInformation, "PowerClips One Level Within PowerClips Extract Contents Delete Frame" End If ExitSub: ActiveDocument.EndCommandGroup Refresh Exit Sub ErrHandler: MsgBox "Error occurred: " & Err.Description & vbCrLf & vbCrLf & "PowerClips_One_Level_Within_PowerClips_Extract_Contents_Delete_Frame()" Resume ExitSub End Sub
This is what I need. The powerclip is inside the other because of a macro that I use that keeps the proportions because there are many shapes.Thank you very much, God bless you, and congratulations for helpinga lot of people here in the community.