I Draw a comic strip and I always scan my drawings and work with them in Corel by placing them in four frames and adding text, so I wrote a little macro that reduces the selected scans and places them inside the frames.
This is the code:
Code:
Sub PlaceInFrames()
Dim sr As ShapeRange
Dim s1 As Shape, s2 As Shape, s3 As Shape, s4 As Shape
Set sr = ActiveSelectionRange
sr.Stretch 0.598
Set s1 = ActivePage.Shapes("Rectangle1")
Set s2 = ActivePage.Shapes("Rectangle2")
Set s3 = ActivePage.Shapes("Rectangle3")
Set s4 = ActivePage.Shapes("Rectangle4")
sr(1).AlignToShape cdrAlignBottom + cdrAlignHCenter, s1
sr(1).AddToPowerClip s1
sr(2).AlignToShape cdrAlignBottom + cdrAlignHCenter, s2
sr(2).AddToPowerClip s2
sr(3).AlignToShape cdrAlignBottom + cdrAlignHCenter, s3
sr(3).AddToPowerClip s3
sr(4).AlignToShape cdrAlignBottom + cdrAlignHCenter, s4
sr(4).AddToPowerClip s4
End Sub
This code didn't work, I had to define four additional shape variables from each one of the selected range and then work with them.
This is the code that works:
Code:
Sub PlaceInFrames()
Dim sr As ShapeRange
Dim s1 As Shape, s2 As Shape, s3 As Shape, s4 As Shape
Dim sr1 As Shape, sr2 As Shape, sr3 As Shape, sr4 As Shape
Set sr = ActiveSelectionRange
sr.Stretch 0.598
Set sr1 = ActiveSelectionRange(1)
Set sr2 = ActiveSelectionRange(2)
Set sr3 = ActiveSelectionRange(3)
Set sr4 = ActiveSelectionRange(4)
Set sr = Nothing
Set s1 = ActivePage.Shapes("Rectangle1")
Set s2 = ActivePage.Shapes("Rectangle2")
Set s3 = ActivePage.Shapes("Rectangle3")
Set s4 = ActivePage.Shapes("Rectangle4")
sr1.AlignToShape cdrAlignBottom + cdrAlignHCenter, s1
sr1.AddToPowerClip s1
sr2.AlignToShape cdrAlignBottom + cdrAlignHCenter, s2
sr2.AddToPowerClip s2
sr3.AlignToShape cdrAlignBottom + cdrAlignHCenter, s3
sr3.AddToPowerClip s3
sr4.AlignToShape cdrAlignBottom + cdrAlignHCenter, s4
sr4.AddToPowerClip s4
End Sub
Why didn't it work the first time when I tried to use the four items in the ShapeRange? Remember I'm totally new to VBA or any form of programming.
Thanks