I need to add all the pages of all open documents to a new document.
Is there a macro available to do that?
If not, any suggestion of where to start?
Here is something to get you started:
It will have a blank first page and there is no control of the order the documents, it just loops through them.
Sub OpenDocToNewDoc() Dim d As Document, dNew As Document Dim impopt As StructImportOptions Dim p As Page Set impopt = CreateStructImportOptions Set dNew = CreateDocument() 'This is needed so that everything is not imported on a single page impopt.MaintainLayers = True For Each d In Application.Documents If d <> dNew Then Set p = dNew.InsertPages(1, False, dNew.Pages.Last.Index) ActiveLayer.ImportEx(d.FullFileName, cdrCDR, impopt).Finish End If Next d End Sub
Happy Coding,
-Shelby
Sorry for the confusion. I rebooted my PC and all works except for the extra page @ the beginning of the dNew.
CreateDocument function creates the document along with the first page, and InsertPages function adds another page right after it. Therefore, all documents are added starting from the second page. You can simply remove the blank first page by placing the line at end of the macro: dNew.Pages(1).Delete
Thanks kindly for that terrific starting point.