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 14-11-2010, 03:36
Jeff Harrison
Guest
 
Posts: n/a
Default combine pages from one file into another

Right now you can import a CDR into another - keeping layers and pages - but it
inserts NEW pages at end, not what we want.

For ex: I want contents on pages 1-50 of file X put into existing pages 1-50 of file Y, preserving coordinates (both files will be same paper size)

How about brute force (but slow) copy paste from one CDR to the other?

Speed is not important for this case.
Reply With Quote
  #2  
Old 16-11-2010, 09:05
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.
Here's a really bad first try...lol (untested), but how do you import adding pages. I'm sure there's a better way but I've been in a time crunch.

-John


Code:
Option Explicit

Sub copyPages()

Dim i As Integer, pn As Integer, count As Integer

i = InputBox("How many new pages where imported?")

pn = ActiveDocument.Pages.count + i

count = 1
For i = pn To ActiveDocument.Pages.count
    ActiveDocument.Pages(i).Activate
    ActivePage.Shapes.All.CreateSelection
    ActiveSelection.Copy
    ActiveDocument.Pages(count).Activate
    ActiveLayer.Paste
    count = count + 1
Next i

End Sub
Reply With Quote
  #3  
Old 16-11-2010, 20:12
Jeff Harrison
Guest
 
Posts: n/a
Default

HI J,

I couldn't get it to work here.

Anyway, my goal is this:

Document A has X amount of pages.

Document B has same amount of pages.

Both files are already open in CorelDRAW. They are the only open files.

I want to copy the contents of each page in Document B and paste over top of whatever may exist in Document A.

Page #s will always correspond 1:1. The user will ensure each doc has same page qty.

So, contents of Page 67 of Document B is copied and pasted into Page 67 of Document A. FWIW, nothing is deleted.

J

[quote=runflacruiser;17404]Hi.
Here's a really bad first try...lol (untested), but how do you import adding pages. I'm sure there's a better way but I've been in a time crunch.

Last edited by Jeff Harrison; 16-11-2010 at 20:36.
Reply With Quote
  #4  
Old 16-11-2010, 20:16
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Ah
I based this on the fact that you would somehow import, append, pages from a doc to and open doc art the end...lol
I wasn't sure how to do it but figured you knew how. I guess I misunderstood the first post.
I think that way would be easier then...
-John
Reply With Quote
  #5  
Old 16-11-2010, 20:31
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.
Ok.
I'm sure there's a better way to do this but here's a quick fix.

-John

Code:
Sub copyPages2()

Dim p As Page, d1 As Document, d2 As Document
Dim i As Integer, j As Integer

If Documents.count <> 2 Then Exit Sub

Set d2 = Documents(2)
Set d1 = Documents(1)

For i = 1 To d1.Pages.count
    For j = 1 To d2.Pages.count
        If j = i And j <= d1.Pages.count Then
            d2.Pages(j).Activate
            d2.Pages(j).Shapes.All.CreateSelection
            d2.Pages(j).Shapes.All.Copy
            d1.Pages(j).Activate
            ActiveLayer.Paste
            Clipboard.Clear
        End If
    Next j
Next i
End Sub
Reply With Quote
  #6  
Old 16-11-2010, 21:16
Jeff Harrison
Guest
 
Posts: n/a
Default

THANKS!

Works in X4/X5, I tried 1000 pages. numbers as Art. text strings copied from one to the other. X5 seemed to be faster for same code. I added optimization to both.

Thanks again...

[quote=runflacruiser;17414]
I'm sure there's a better way to do this but here's a quick fix.
Reply With Quote
  #7  
Old 16-11-2010, 21:22
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.
No prob.
I'll see about a better way too.

Interesting that it would fail if I didn't add the clipboard.Clear

Seems the memory was building up quickly and the clipboard didn't seem to overwrite each time.

-John
Reply With Quote
  #8  
Old 16-11-2010, 21:48
Jeff Harrison
Guest
 
Posts: n/a
Default

Hi,

Actually i pulled that command and it worked OK in X4/X5 on simple text

perhaps on typical or more complicated pages one should keep it though, since the clipboard can be have very complex items on it and should be wiped.

Quote:
Originally Posted by runflacruiser View Post
Hi.
No prob.
I'll see about a better way too.
Interesting that it would fail if I didn't add the clipboard.Clear
Seems the memory was building up quickly and the clipboard didn't seem to overwrite each time.
-John
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
I Need to combine the two Macro’s below into One Button: GWB Daniels Macros/Add-ons 1 28-07-2010 23:53
Combine Textrows... WernerHo Macros/Add-ons 6 15-12-2009 10:44
Urgent: Coreldraw 3x: how to export all the pages in .CDR file into one .SVG file balan CorelDRAW/Corel DESIGNER VBA 1 21-05-2008 07:47
Import SVG File to Separate Pages on Document Load Jadus CorelDRAW/Corel DESIGNER VBA 5 30-06-2005 12:56
Corel 9 VBA Weld and Combine korner CorelDRAW/Corel DESIGNER VBA 2 07-10-2004 10:48


All times are GMT -5. The time now is 05:44.


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