OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Corel User Forums > CorelDRAW > Macros/Add-ons

Thread Tools Search this Thread Display Modes
Old 24-08-2011, 15:17
Posts: n/a
Default Issue with macro.

On this macro I am wanting my current selection to duplicate and align to said shape. With text only it is fine but when I have a group of shapes it does some weird duplications or it aligns them while ignoring they fact they're group. Any help that would great.

Sub LanyardProofLEFT()

    Dim s As Shape
    Dim sr As ShapeRange
    Dim sRightnobreak As Shape, sLeftnobreak As Shape, sLeftbreak As Shape, sRightbreak As Shape, sBackBreak As Shape, sNoBreakBack As Shape
    If ActiveSelection.Shapes.Count = 0 Then
        Response = MsgBox("Nothing was selected, would you like to select all objects?", vbYesNo, "AlignToNamedShapes")
        If Response = vbYes Then
            Set sr = ActivePage.Shapes.All 'Get all the shapes on the current page
            Exit Sub
        End If
        Set sr = ActiveDocument.SelectionRange.Shapes.FindShapes(Recursive:=False) 'Get the shapes in current selection
    End If
    Set sRightnobreak = ActivePage.FindShape(Name:="rightnobreak")
    Set sLeftnobreak = ActivePage.FindShape(Name:="leftnobreak")
    Set sLeftbreak = ActivePage.FindShape(Name:="leftbreak")
    Set sRightbreak = ActivePage.FindShape(Name:="rightbreak")
    Set sBackBreak = ActivePage.FindShape(Name:="BackBreak")
    Set sNoBackBreak = ActivePage.FindShape(Name:="NoBackBreak")

        For Each s In sr.Shapes.FindShapes
        s.AlignToShape cdrAlignHCenter + cdrAlignVCenter, sLeftnobreak
    Next s

End Sub

Last edited by ProofingGuy; 24-08-2011 at 15:25.
Reply With Quote
Old 25-08-2011, 01:27
shark shark is offline
Senior Member
Join Date: Aug 2010
Location: Russia, Belgorod
Posts: 146

Try change this lines:
Set sr = ActiveDocument.SelectionRange.Shapes.FindShapes(Recursive:=False)
Set sr = ActiveSelectionRange
For Each s In sr.Shapes.FindShapes
For Each s In sr
Reply With Quote
Old 25-08-2011, 17:20
Posts: n/a

Thank you.
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Issue with SelectShapesAtPoint HeauxmBru Macros/Add-ons 3 14-08-2011 13:43
Having a bit of a timing issue gag546112 CorelDRAW/Corel DESIGNER VBA 7 22-08-2010 19:26
PMS color - X5 Issue biok CorelDRAW/Corel DESIGNER VBA 4 29-04-2010 14:52
Macro bug / units issue Rick Randall CorelDRAW/Corel DESIGNER VBA 2 19-02-2008 08:22
Eraser issue jahmer General 0 17-01-2008 16:59

All times are GMT -5. The time now is 09:10.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com