Macro - Placing a copy of single object in multiple Power Clips

Welcome. I would like to ask for help in writing a macro that duplicates the last selected object and places copies in separate PowerClips.

The loop should look like this:

.GetSize of first PowerClip object

duplicate the last previously selected object

make size of copied object same as first Powerclip

place the copied object do the first PowerClip

and the same loop for other powek clips

I would be grateful for your help :)

  • This works for me in a recent version of CorelDRAW. I don't know if there is anything that would need to be changed to make it work in X4.

    1. Select the PowerClips.

    2. Add the object to be duplicated to the selection.

    3. Run the macro.
    Sub dupe_to_powerclips()
    Dim sToDupe As Shape
    Dim sDupe As Shape
    Dim sr As ShapeRange
    Dim lngCounter As Long
        On Error GoTo ErrHandler
        ActiveDocument.BeginCommandGroup "Dupe to PowerClips"
        Set sr = ActiveSelectionRange
        Set sToDupe = sr(1)
        For lngCounter = 2 To sr.Count
            Set sDupe = sToDupe.Duplicate
            sDupe.SetSize sr(lngCounter).SizeWidth, sr(lngCounter).SizeHeight
            sDupe.AddToPowerClip sr(lngCounter), cdrTrue
        Next lngCounter
        Exit Sub
        MsgBox "Error occured: " & Err.Description
        Resume ExitSub
    End Sub

    In use, it looks like this:

    VIDEO: Dupe to PowerClips


Reply Children