![]() |
#1
|
||||
|
||||
![]()
There are objects inside a shape, square, circle or whatever.
How to group them and become centered within that shape? I guess they would become grouped if they aren't and center within? See pic below.
__________________
Using X4 & 2019 2020... yikes 2021 |
#2
|
|||
|
|||
![]()
Try this (seemed to work using X6):
Code:
Sub AlignGroupToObject() Dim sr As ShapeRange Dim s as shape If ActiveDocument Is Nothing Or ActiveSelection.Shapes.Count = 0 Then Exit Sub Set sr = ActiveSelection.Shapes.all ActiveSelection.Shapes(1).RemoveFromSelection Set s = ActiveSelection.Shapes.all.Group sr.CreateSelection s.AlignToShape cdrAlignHCenter, ActiveSelection.Shapes(1) s.AlignToShape cdrAlignVCenter, ActiveSelection.Shapes(1) End Sub |
#3
|
||||
|
||||
![]()
Thanks Nobody
It works in X4 & 2017 just fine. Pint of Guinness to your right ![]() |
#4
|
|||
|
|||
![]()
Glad it worked, thanks for the Guinness, haven't had a real one in over 20 years!
|
#5
|
|||
|
|||
![]() Code:
Sub CenterGroup() Dim s As Shape, sr As ShapeRange Set sr = ActiveSelectionRange: If sr.Count = 0 Then Beep: Exit Sub Set s = sr.FirstShape: sr.Remove 1 'align to bottom shape sr.AlignRangeToShape cdrAlignHCenter + cdrAlignVCenter, s sr.Group End Sub Last edited by shark; 20-03-2018 at 07:13. Reason: group shaperange |
#6
|
||||
|
||||
![]()
@shark
Wooo... many months later. Yes this code is good as well. Need some code fixing for 2018 version |
![]() |
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 |
include inside groups | gorgo | CorelDRAW/Corel DESIGNER VBA | 1 | 10-12-2012 23:01 |
Page centered at 0,0 | CWCN | General | 1 | 15-06-2010 14:49 |
How do I make Past Inside? | Aloninet | General | 1 | 20-07-2006 06:16 |
How to place a bitmap inside text or other objects? | Alex | FAQ | 1 | 24-05-2005 12:01 |
Select objects inside another | shelbym | CorelDRAW/Corel DESIGNER VBA | 1 | 25-11-2003 17:01 |