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:
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 IntegerDim FilePath As StringDim FileContent As String
'----------------------------------------------------------------- Folder Path
On Error Resume NextFilePath = "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 TextFileLine Input #TextFile, FileContentClose #TextFile
'------------------------------------------------- Opens New Document & Adds Pages
Dim doc1 As DocumentSet doc1 = CreateDocument()doc1.Name = FileContent + 1
'------------------------------------------------- Stores New Proof Number
Open FilePath For Output As TextFileOn Error Resume NextPrint #TextFile, ActiveDocument.NameClose TextFile
Optimization = True
'------------------------------------------------- Adds Pages to Document
Dim p1 As PageSet p1 = ActiveDocument.InsertPagesEx(1, False, ActivePage.Index, 8.5, 11#)p1.Activatep1.Name = "Proof"Dim p2 As PageSet p2 = ActiveDocument.InsertPagesEx(1, False, p1.Index, 8.5, 11#)p2.Activatep2.Name = "CutFile"ActiveDocument.Pages(1).ActivateActivePage.Name = "Mat" '------------------------------------------------- Opens Metadata Form'saveMetaData.Show vbModeless'------------------------------------------------
ExitSub:Optimization = FalseActiveWindow.RefreshApplication.RefreshActiveDocument.EndCommandGroupExit Sub ErrHandler:MsgBox "Something Went Wrong..." & vbCr & "Error occured: " & Err.DescriptionResume ExitSub
End Sub
Why duplicate two pages, when you can delete the extra ones and save the document under a different name?
Good question. So, when my customer requests a change to design number 4444 and asks to make the background Red instead of Blue. I will reference design 4444 - Create a new design, make the color change (but in order to do that i need everything from 4444 to copy over to the new design document). I have page 1 for the "mat" and Page 2 for the proof. I need both to carry over (along with metadata if possible).