![]() |
#1
|
|||
|
|||
![]()
Hi, I'm trying to code a process to copy shapes from one page to another in the same document. First of all I run a sub that copies all the shapes in a layer that functions as a template for the new page with this code:
PagOrig.Layers(1).Shapes.All.Copy PagNueva.Layers(1).Paste PagOrig.Layers(11).Shapes.All.Copy PagNueva.Layers(11).Paste Layer 1 and 11 are the ones that forms the template in the new page. The previous code works fine. The shapes on the original page are organized by layers and I need them to copy that way. I made another sub for achieving this. Dim Sh As Shape Dim LayerX As Layer Dim i, Rows as Single Dim PagOrig As Page 'this is the orginal page Dim PagNueva As Page 'this is the new page Rows=10 Set PagOrig = ActiveDocument.Pages(1) Set PagNueva = ActiveDocument.Pages(2) For i = 1 To Rows Set LayerX = PagNueva.Layers(i) If condition = true then LayerX.Shapes.All.Delete 'AS YOU CAN SEE IN THE FIRST CHUNK OF CODE I ALREADY COPIED 'THE SHAPES IN LAYER 1, SO HERE I DELETE ALL THE SHAPES OF 'LAYER NO. 1 ONLY IF A CONDITION IS TRUE PagOrig.Layers("Logos").Shapes("LogoCasa").Copy 'I USED A BREAKPOINT AND NOTICE THAT WHEN THIS INSTRUCTION 'IS EXECUTED THE TARGET SHAPE "LogoCasa" IS SELECTED, SO I 'GUESS IS COPYING IT. ActiveDocument.Pages(2).Layers("1").Paste 'FOR SOME REASON THIS INSTRUCTION AIN'T PASTING THE SHAPE 'THIS IS WHERE THE PROBLEM IS. The weird thing is that I create another module and code a more simple way to copy paste the shape to the destination layer and it works. Here is that code: ActiveDocument.Pages(1).Layers("Logos").Shapes("LogoCasa").Copy ActiveDocument.Pages(2).Layers("1").Paste What could be the problem? thank you. |
#2
|
||||
|
||||
![]()
ActiveDocument.Pages(1).Shapes("something").CopyToLayer ActiveDocument.Pages(21).Layers("somelayername")
or ActiveLayer.Shapes("something").CopyToLayer ActivePage.Layers("somelayername") |
![]() |
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 |
corel X3 slow to copy and paste | mick classen | CorelDRAW/Corel DESIGNER VBA | 5 | 29-03-2007 14:05 |
copy paste macro for illustrator... | rmclaug5 | Macros/Add-ons | 1 | 12-12-2006 10:30 |
best way to copy and paste a file w/ vba? | xombie | CorelDRAW/Corel DESIGNER VBA | 4 | 22-11-2005 09:45 |
Copy/Paste doesn't seem to work. | Alex | FAQ | 1 | 01-06-2005 12:25 |
Copy and paste objects in CDR9 | macnab | CorelDRAW/Corel DESIGNER VBA | 0 | 03-09-2003 10:59 |