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
Perfect! Thanks kindly.
Shelby,
Oops! I spoke before I even tried it. The code is so straightforward I was sure it would work but had several problems that I don't understand. e.g., the 1st page in dNew is blank. Total # of pages is correct but no data brought in from 2nd document.
Sorry for the confusion. I rebooted my PC and all works except for the extra page @ the beginning of the dNew.
Yeppers, as I said there is room to improve it. Wanted to keep it very simple as a starting point for you.
Happy coding,