![]() |
#1
|
|||
|
|||
![]()
I need to do some complex unrevertible tasks to the shapes of "original" Page 1.
e.g. continous break apparts, convert to curves etc... and don't like to affect the shapes in the "original" Page 1. So, 1. I copy the selected shapes 2. Create a new page "Page 2" 3. Activate "Page 2" (it is not mandatory to do this) 3. Paste them into "Page 2" (until that point, all works FINE).. Now I have to do my tasks! All the tasks are taking place at "Page 1" despite my activation on "Page 2"!!! ![]() Code:
Public Sub CopyToNewPage() ActiveDocument.Selection.Copy ActiveDocument.AddPages 1 ActiveDocument.ActiveLayer.Paste MsgBox ActiveDocument.ActivePage.Name 'my tasks End Sub Now, watch carefully... I have added a MessageBox that returns the active page's name... It returns "Page 1" ![]() If I put a breakpoint on the Paste or the Msgbox command, after the resume It returns "Page 2" ![]() ![]() ![]() Note: The same issue appears as well as to Shelbym's code which does the same work, posted somewhere into the forum. I added the msgbox command. Code:
Public Sub CopyToNext() Dim sr As ShapeRange Dim s As Shape Dim p As Page Set sr = ActiveSelectionRange Set p = ActiveDocument.InsertPages(1, False, ActivePage.Index) For Each s In sr s.Layer.Activate s.Duplicate s.MoveToLayer ActiveDocument.Pages(ActivePage.Index + 1).ActiveLayer Next s ActiveDocument.Pages.Last.Activate MsgBox ActiveDocument.ActivePage.Name End Sub
Last edited by sakis_drm; 22-06-2008 at 10:45. |
#2
|
|||
|
|||
![]()
Seems like Corel's bug..
If anyone has any idea or If anyone faces the same problem or If anyone has solved thar problem in the past, It would be great to post his opinion.. |
#3
|
||||
|
||||
![]()
Alright I have only tested this in X4, but I think it does everything you want. It takes the selection, creates a new page and moves a duplicate of the selection to the new page. It then applies a yellow fill to each of the new shapes on the new page. The original page is left intact with no changes.
Code:
Sub CopyToNextPage() Dim s As Shape Dim sr As ShapeRange Dim p As Page Set sr = ActiveSelectionRange.Duplicate() 'Duplicate the selection Set p = ActiveDocument.InsertPages(1, False, ActivePage.Index) 'Create a new Page sr.MoveToLayer p.Layers("Layer 1") 'Move the duplicates to the new page 'Do something to the duplicates (Fill them Yellow) For Each s In sr s.Fill.ApplyUniformFill CreateCMYKColor(0, 0, 100, 0) Next s End Sub -Shelby |
#4
|
|||
|
|||
![]()
Thanks for you response,
my original issue is the same because if i add the line... Quote:
In your code "CopyToNextPage" you refear to an object "SR". In my code I reafer to activepage's objects. That is the difference... ![]() I need a command that will realy activates the newly created page.. something like... 1. Add a page 2. Activate that new page 3. MsgBox ActiveDocument.ActivePage.Name 4. must return the new page's name Thanks a lot. |
#5
|
||||
|
||||
![]()
***Update: I have now tested in 12 and X3 and I get the same results: Page1, Page2, Page2 as expected
What version are you using? I tried the following code in X4 SR1 Code:
Sub CopyToNextPage() Dim s As Shape Dim sr As ShapeRange Dim p As Page MsgBox ActiveDocument.ActivePage.Name Set sr = ActiveSelectionRange.Duplicate() 'Duplicate the selection Set p = ActiveDocument.InsertPages(1, False, ActivePage.Index) 'Create a new Page p.Activate MsgBox ActiveDocument.ActivePage.Name sr.MoveToLayer p.Layers("Layer 1") 'Move the duplicates to the new page 'Do something to the duplicates (Fill them Yellow) For Each s In sr s.Fill.ApplyUniformFill CreateCMYKColor(0, 0, 100, 0) Next s MsgBox ActiveDocument.ActivePage.Name End Sub -Shelby Last edited by shelbym; 01-07-2008 at 16:21. Reason: Tested is 12 and X3 |
#6
|
|||
|
|||
![]()
I got "Page 1", "Page 1", "Page 1" on Corel version 14.0.0.567
I ll try to update my version if i can ![]() The only way to get "Page 2" is to place a breakpoint on the last msgbox command. Maybe I have to do that in 2 steps to force the user to press another button in order to execute the procedures to the newly created page after the page activation. ![]() |
#7
|
||||
|
||||
![]()
Have you installed the service pack for CGS X4? If not, you should
![]() http://www.corel.com/servlet/Satelli...=1205332430735 |
#8
|
|||
|
|||
![]()
Service Pack 1 solved that issue.
Alex and Shelbym, thanks a lot! Nice to meet you! |
![]() |
Tags |
activate, breakpoint, page, paste |
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 |
Import Page Only | bprice | CorelDRAW/Corel DESIGNER VBA | 4 | 11-06-2008 06:03 |
Duplicating original page for multi-page layout | psypha | General | 1 | 06-08-2007 14:05 |
Problem with Page Numbering macro | pmills | Macros/Add-ons | 1 | 07-05-2005 08:49 |
why can not do two pagenumbering in one page? | olympiatr | CorelDRAW/Corel DESIGNER VBA | 2 | 20-10-2004 03:09 |
Page Numbering | Hernán | CorelDRAW/Corel DESIGNER VBA | 3 | 11-06-2004 02:25 |