![]() |
#1
|
|||
|
|||
![]()
I've come up with my own little macro to distribute shapes evenly across a rectangle either horiz or vertically. If you use the distribute docker you can already "distribute across the page" but it places the outer shapes on the edge of the page. My macro sets equal distances across the rectangle including edges.
Simply select your shapes that are inside the rectangle then shift select your rectangle and run the appropriate macro Works great for aligning/distributing paragraph text ................ Sub DistributeHorizWithin() Dim sr As ShapeRange, s As Shape Dim x As Double, y As Double, w As Double, h As Double ActiveDocument.BeginCommandGroup "DistributeHorizWithin" Set sr = ActiveSelectionRange If sr.Count = 0 Then Exit Sub sr.GetBoundingBox x, y, w, h sr.Add ActiveLayer.CreateLineSegment(x, y, x, y + h / 5) ActiveShape.Name = ("LS1") sr.Add ActiveLayer.CreateLineSegment(x, y, x, y + h / 5) ActiveShape.Move w / 1, 0 ActiveShape.Name = ("LS2") sr.AddToSelection sr(1).RemoveFromSelection ActiveSelectionRange.Distribute cdrDistributeHSpacing ActivePage.Shapes.FindShape("LS1").Delete ActivePage.Shapes.FindShape("LS2").Delete ActiveDocument.EndCommandGroup End Sub Sub DistributeVertWithin() Dim sr As ShapeRange, s As Shape Dim x As Double, y As Double, w As Double, h As Double ActiveDocument.BeginCommandGroup "DistributeVertWithin" Set sr = ActiveSelectionRange If sr.Count = 0 Then Exit Sub sr.GetBoundingBox x, y, w, h sr.Add ActiveLayer.CreateLineSegment(x, y, x + h / 5, y) ActiveShape.Name = ("LS1") sr.Add ActiveLayer.CreateLineSegment(x, y, x + h / 5, y) ActiveShape.Move 0, h / 1 ActiveShape.Name = ("LS2") sr.AddToSelection sr(1).RemoveFromSelection ActiveSelectionRange.Distribute cdrDistributeVSpacing ActivePage.Shapes.FindShape("LS1").Delete ActivePage.Shapes.FindShape("LS2").Delete ActiveDocument.EndCommandGroup End Sub |
![]() |
Tags |
distribute, macro, paragraph text |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
X6.1 Align & Distribute changes | PAnderson | CorelDRAW/Corel DESIGNER VBA | 7 | 21-09-2012 01:56 |
distribute in pages | buga | Macros/Add-ons | 4 | 28-02-2011 13:13 |
Shapes outside page bounds automatically move to Desktop Layer | Janga | General | 5 | 16-06-2010 15:52 |
How to distribute the program? | ricky0721 | CorelDRAW/Corel DESIGNER VBA | 3 | 26-03-2008 10:26 |
how to distribute a macro file | mgmcs | Macros/Add-ons | 4 | 25-05-2006 08:23 |