Sub test() Dim sr As ShapeRange, s1 As Shape, s2 As Shape Set sr = ActiveSelectionRange If sr.Count <> 3 Then MsgBox "3 shapes must be selected": Exit Sub Set s1 = sr(3).Intersect(sr(1), False, True) Set s2 = sr(2).Intersect(sr(1), False, True)End Sub
EDIT: sorry 2nd step should be TRIM
Sub test() Dim sr As ShapeRange, s1 As Shape, s2 As Shape Set sr = ActiveSelectionRange If sr.Count <> 3 Then MsgBox "3 shapes must be selected": Exit Sub Set s1 = sr(3).Intersect(sr(1), False, True) Set s2 = sr(2).Trim(sr(1), False, True)End Sub
Thanks Mek, This worked somewhat. What I didn't realize was that after the intersect another shape was created isn't in the original SelectionRange. There are now 4 objects in the Object Manager instead of 3. i now need the trim to happen with the 4th and 2nd object. Do I create a new SelectionRange and then trim?
Hope this isn't too confusing.
3 objects selecsted and macro applied left 3 objects (2 deleted and two created).
What should be the result?
Best regards
Mek
I've uploaded to small videos that can probably explain it better. I hope. Here's what I see happening when I step through the code.
1. The 3 objects are selected
2. The 2 shapes are intersected deleting the source but the intersection creates another shape so there are still 3 shapes
3. The next step in the code is Trim but its trimming the new shape and the back layer.
For Part I I would try to use following:
Sub test() Dim sr As ShapeRange, s1 As Shape, s2 As Shape Set sr = ActiveSelectionRange If sr.Count <> 3 Then MsgBox "3 shapes must be selected": Exit Sub Set s1 = sr(3).Trim(sr(2), False, False) Set s2 = s1.Trim(sr(1), False, False)End Sub