I have two documents, both are multiple pages, the exact number of pages. I want to place one exactly on top of the other without making the final document twice the number of pages. When I do "import" and click the upside down "L" shape, it places the first page right where I need it to on page one, but then it places the other pages in their own blank sheet, when I need them to be placed on top of the next subsequent page.
If I'm not clear for example, I want page 1 of document 1 and page 1 of document 2 to become one piece. Since this document is many pages (87). I don't want to have to copy/paste 87 times, and I have to do this several times at that for several documents.
I haven't tried this before, but I stumbled through a macro that seems to work for me on X7, at least for my testing using a couple of simple documents:
Sub copy_paste_all_multiple_pages()Dim doc_source As DocumentDim doc_target As DocumentDim page_index As LongDim paste_layer As LayerSet doc_source = OpenDocument("d:\test_B.cdr")Set doc_target = OpenDocument("d:\test_A.cdr")Application.Optimization = TrueFor page_index = 1 To doc_source.Pages.Count doc_source.Pages.Item(page_index).Shapes.All.Copy Set paste_layer = doc_target.Pages.Item(page_index).CreateLayer("Paste Layer") paste_layer.PasteNext page_indexApplication.Optimization = FalseApplication.RefreshEnd Sub
That walks through the pages in order. For each page, it copies from the "source" document, then creates a new layer on the corresponding page of the "target" document and pastes the copied content there.
I didn't include any user interface for selecting the documents, and it's not checking to see if the page count is the same for the two documents.
No guarantees here. Don't try it on anything that you don't have safe copies of!
I worked this up a bit at home this evening, where I have X5 available, with a little userform.
This allows one to browse to select the source and target files. It doesn't work directly on the target file, but instead, opens it as a copy. So, the result is a new file that starts as a copy of the specified target file, but then has the content from the source file pasted into it, page by page.
The macro:
copy paste all multiple pages.gms
The userform looks like this:
Save