Duplicate Page 1 & 2 To New Doc Page's 1 & 2 ?

I need help getting this started. 

This is probably simpler than I'm thinking it is. Or not? We'll see... This is my attempt to add onto what I've already had going. I have community discussion where I'm using a .txt file to name my Corel Documents. This part is done and works well.

Now that my documents are created and saved. I want to duplicate everything that is on  Page1 & 2 to a new Document (Pages 1 & 2). I might figure out the rest like using my .txt file to name the new duplicated document. 

I just need help getting the items over to the correct page. 

Recap:

  • Macro will create a new Document and copy every from doc 1 to doc 2 on the correct pages. Possibly copy over metadata to new document as well.

Can you help? I do, however, need to utilize the code below, though. Because every new document must be named with a new number. I just need all it's contents copied over to the new document (page 1 & 2) and possibly (but not necessary) it's metadata.

Here is the code used from my previous discussion. 

Just run this code after you do the highlight below w/Corel open. It will create a New Document and Add a Number as Document Name. But first you have to save the text file somewhere and save a number inside it. 

Sub newDesignNumber()

Dim TextFile As Integer
Dim FilePath As String
Dim FileContent As String

'----------------------------------------------------------------- Folder Path

On Error Resume Next
FilePath = "N:\Logo Database\Design Number" & ".txt"  ' < Create a new txt file and start with a number ex: 200 save on desktop and save path here.

'----------------------------------------------------------------- Get String (Proof Number) From Text File.

TextFile = FreeFile

On Error GoTo ErrHandler

Open FilePath For Input As TextFile
Line Input #TextFile, FileContent
Close #TextFile

'------------------------------------------------- Opens New Document & Adds Pages

Dim doc1 As Document
Set doc1 = CreateDocument()
doc1.Name = FileContent + 1

'------------------------------------------------- Stores New Proof Number

Open FilePath For Output As TextFile
On Error Resume Next
Print #TextFile, ActiveDocument.Name
Close TextFile

Optimization = True

'------------------------------------------------- Adds Pages to Document

Dim p1 As Page
Set p1 = ActiveDocument.InsertPagesEx(1, False, ActivePage.Index, 8.5, 11#)
p1.Activate
p1.Name = "Proof"
Dim p2 As Page
Set p2 = ActiveDocument.InsertPagesEx(1, False, p1.Index, 8.5, 11#)
p2.Activate
p2.Name = "CutFile"
ActiveDocument.Pages(1).Activate
ActivePage.Name = "Mat"

'------------------------------------------------- Opens Metadata Form
'saveMetaData.Show vbModeless
'------------------------------------------------

ExitSub:
Optimization = False
ActiveWindow.Refresh
Application.Refresh
ActiveDocument.EndCommandGroup
Exit Sub

ErrHandler:
MsgBox "Something Went Wrong..." & vbCr & "Error occured: " & Err.Description
Resume ExitSub

End Sub

Parents Reply
  • We run the macro and it names the document with the last stored number on the file.

    And what is your question? Your macro accesses the server, gets the last file number from there and creates a new document with the following number. Such a macro can  be tied to the Create_Document event, in order not to start it manually

Children