help in powerclip

how to extract a powerclip and crop the outside design while extracting ?

Parents
No Data
Reply
  • The following changes will keep the PowerClip shape but remove the X. This version does search for every PowerClip on the current Page. If you want to do another Page, change to that Page and run again.

    Sub ExtractAndCropFromPowerClip()
        Dim s As Shape, sTrim As Shape, sInside As Shape, sDup As Shape
        Dim srInside As ShapeRange, srPowerClips As ShapeRange, srCombine As New ShapeRange
        Dim x As Double, y As Double, w As Double, h As Double
        
        Set srPowerClips = ActivePage.Shapes.FindShapes(Query:="!@com.powerclip.IsNull")
        
        'Check that they selected object is a PowerClip
        If srPowerClips.Count = 0 Then
            MsgBox "No PowerClips found on current Page."
            Exit Sub
        End If
        
        For Each s In srPowerClips
            Set srInside = s.PowerClip.ExtractShapes
            Set sInside = srInside.Group
            
            srInside.GetBoundingBox x, y, w, h
            
            Set sRect = ActiveLayer.CreateRectangle(x - 1, y - 1, x + w + 1, y + h + 1)
            Set sDup = s.Duplicate
            
            srCombine.Add sRect
            srCombine.Add sDup
            
            Set sTrim = srCombine.Combine
            
            sTrim.Trim sInside, False, False
            
            If s.PowerClip.Shapes.Count = 0 Then
                s.CreateSelection
                Application.FrameWork.Automation.Invoke "7b022531-3cd7-487f-a797-9d80179dc821"
            End If
        Next s
    End Sub
    

    Happy coding, 

    -Shelby

Children