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).
ok. Then you can try copy page's content to clipboard and paste it into another page
Dim AnotherPage As Page
ActivePage.Shapes.All.Copy
...
'go to new document and set AnotherPage = Doc.Pages(1) or Pages(2)
AnotherPage.Activate
AnotherPage.ActiveLayer.Paste
I think shark_ was spot on. Do a save as with the original file, so the original is safe. Then make the changes. Everything needed (medadata) is in the new file saved with the new version name. Just delete the excess.
Your code can parse and incriment the current filename of the original file, to use as the Save As file name for the new version to automate your process. Write an aditional a sub routine to remove any excess from the new file as needed.
Using a .txt file for version tracking makes the code dependant on an external file, and limits the naming convention to a single version stream.
A good filename parsing routine, used with a strong naming convention, can eliminate external file dependancy.
Using each files name to store the version info in stead of an external .txt file frees you to create a powerful versioning routine, which works for multiple projects, each using different names and version levels.
This worked. Thank you for the direction.