OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 16-07-2008, 14:10
ecanseco
Guest
 
Posts: n/a
Default Copy Paste shape problem

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.
Reply With Quote
  #2  
Old 17-07-2008, 00:17
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

ActiveDocument.Pages(1).Shapes("something").CopyToLayer ActiveDocument.Pages(21).Layers("somelayername")

or

ActiveLayer.Shapes("something").CopyToLayer ActivePage.Layers("somelayername")
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
corel X3 slow to copy and paste mick classen CorelDRAW/Corel DESIGNER VBA 5 29-03-2007 15:05
copy paste macro for illustrator... rmclaug5 Macros/Add-ons 1 12-12-2006 11:30
best way to copy and paste a file w/ vba? xombie CorelDRAW/Corel DESIGNER VBA 4 22-11-2005 10:45
Copy/Paste doesn't seem to work. Alex FAQ 1 01-06-2005 13:25
Copy and paste objects in CDR9 macnab CorelDRAW/Corel DESIGNER VBA 0 03-09-2003 11:59


All times are GMT -5. The time now is 03:14.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com