![]() |
#1
|
|||
|
|||
![]()
I have a 16 page CorelDraw 12 document. Each page has a piece of clipart (one group of various objects) and a single piece of artistic text grouped together. I just tried the following macro
Code:
Sub ungroup() Dim p As Page For Each p In ActiveDocument.Pages ActivePage.Shapes.All.CreateSelection Dim grp1 As ShapeRange Set grp1 = ActivePage.Shapes.All.UngroupEx Next p End Sub Group of 1 Objects on Puzzle Puzzle is the name of the layer. If I ungroup the group of 1 object I end up back where I started with a group of two objects on the page. What am I doing wrong? What I want to do is ungroup the text and leave the clipart group intact. Thanks, Chris (Hunt) |
#2
|
||||
|
||||
![]() Code:
Sub ungroup() Dim p As Page For Each p In ActiveDocument.Pages ActivePage.Shapes.All.CreateSelection Dim grp1 As ShapeRange Set grp1 = ActivePage.Shapes.All.UngroupEx Next p End Sub Code:
Sub ungroup() Dim p As Page For Each p In ActiveDocument.Pages ActivePage.Layers.Item("Puzzle").Activate ActivePage.Shapes.All.UngroupAll Next p End Sub
__________________
Sean Waiting for a ride in the T.A.R.D.I.S. |
#3
|
||||
|
||||
![]()
Try adding p.Activate before doing anything with the shapes on a page. This ensures that the page is active before you do something. Normally this should be your concern as CorelDRAW should do it autmatically, but there are some issue where this step might be missing which could cause problems.
Code:
Sub Ungroup() Dim p As Page For Each p In ActiveDocument.Pages p.Activate ActivePage.Shapes.All.Ungroup Next p End Sub |
#4
|
||||
|
||||
![]()
I just realized something. You are using ActivePage while looping through different pages. This means that if your active page was page 1, looping through other pages will not change the active page (unless you use Activate method I mentioned earlier). You need to use the reference to your page used in the loop, that is, p.
Here is the revised code: Code:
Sub Ungroup() Dim p As Page For Each p In ActiveDocument.Pages p.Shapes.All.Ungroup Next p End Sub Last edited by Alex; 08-03-2006 at 10:43. |
#5
|
|||
|
|||
![]()
Thanks for the replies. After some testing I realise that some other part of my total code was causing the weird message. I've adjusted it and it seems to be working fine now.
Best wishes, Chris |
![]() |
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 |
selecting objects in a group | bloodgroove | General | 2 | 19-01-2006 12:11 |
Sorting and Grouping Objects by Color | Joyce Schneider | General | 1 | 12-07-2005 00:34 |
Glitches with Names of Objects | Granite Golem | CorelDRAW/Corel DESIGNER VBA | 14 | 01-06-2005 03:38 |
Need help accessing objects in a group | ama | CorelDRAW/Corel DESIGNER VBA | 5 | 20-02-2004 11:28 |
I need to update objects visibility faster | NEHovis | Corel Photo-Paint VBA | 0 | 18-07-2003 07:54 |