Merge - Weave two documents odd and even pages

Anonymous
2015-09-25T14:40:04+00:00

I have two documents in Word.

One is the even pages with powerpoint slides.

The odd pages are the tutorial for the slides.  First odd page 1 is the cover sheet.

so when printed I will see the powerpoint slides (in Word three on a page} on the left and the tutorial on the right.

So printing duplex I will print Page 1 - Cover and page two -first 3 slides.

Then page 3 tutorial for page two and page 4 next set of 3 slides.

this is several manuals of over 100 pages each

In PDF  I can use PDFTK  with two file even.pdf and odd.pdf

pdftk A=even.pdf B=odd.pdf shuffle A Bend-1 output merged.pdfHow can I merge two word documents odd.doc  and even.doc?
Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes
Answer accepted by question author
  1. Doug Robbins - MVP - Office Apps and Services 322K Reputation points MVP Volunteer Moderator
    2015-09-26T07:02:47+00:00

    The code was developed for someone else many years ago and it appears that somewhere along the way, I modified it to do what someone else wanted.

    The following should do a better job in your case:

        Dim sourcea As Document, sourceb As Document, target As Document, Pages As Integer, Counter As Integer, targetrange As Range

        Dim evenpage As Range

        Set sourcea = Documents.Open(FileName:="...") 'Document containing the odd pages

        Set sourceb = Documents.Open(FileName:="...") 'Document containing the even pages

        sourceb.Repaginate

        Pages = sourceb.BuiltInDocumentProperties(wdPropertyPages)

        Set target = Documents.Add

        target.PageSetup.LeftMargin = sourcea.PageSetup.LeftMargin

        target.PageSetup.RightMargin = sourcea.PageSetup.RightMargin

        target.PageSetup.TopMargin = sourcea.PageSetup.TopMargin

        target.PageSetup.BottomMargin = sourcea.PageSetup.BottomMargin

        target.AcceptAllRevisions

        Counter = 0

        While Counter < Pages

            sourcea.Activate

            Selection.HomeKey wdStory

            ActiveDocument.Bookmarks("\page").Range.Copy

            Set targetrange = target.Range

            targetrange.Collapse wdCollapseEnd

            targetrange.Paste

            sourcea.Bookmarks("\page").Range.Cut

            sourceb.Activate 

            Selection.HomeKey wdStory

            ActiveDocument.Bookmarks("\page").Range.Copy

            Set targetrange = target.Range

            targetrange.Collapse wdCollapseEnd

            targetrange.Paste

            targetrange.Start = targetrange.End

            targetrange.InsertBreak Type:=wdPageBreak

            sourceb.Bookmarks("\page").Range.Cut

            Counter = Counter + 1

        Wend

        sourcea.Range.Copy

        Set targetrange = target.Range

        targetrange.Collapse wdCollapseEnd

        targetrange.Paste

        sourcea.Close wdDoNotSaveChanges

        sourceb.Close wdDoNotSaveChanges

    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Doug Robbins - MVP - Office Apps and Services 322K Reputation points MVP Volunteer Moderator
    2015-09-25T23:58:02+00:00

    In the following macro, you will need to insert the path and file name of the respective documents into the commands

    Documents.Open(FileName:="...")

    Dim sourcea As Document, sourceb As Document, target As Document, Pages As Integer, Counter As Integer, targetrange As Range 'targetrange added

    Dim evenpage As Range

    Set sourcea = Documents.Open(FileName:="...")

    sourcea.Repaginate

    Pages = ActiveDocument.BuiltInDocumentProperties(wdPropertyPages)

    MsgBox Pages

    Set sourceb = Documents.Open(FileName:="...")

    Set target = Documents.Add

    target.PageSetup.LeftMargin = sourcea.PageSetup.LeftMargin

    target.PageSetup.RightMargin = sourcea.PageSetup.RightMargin

    target.PageSetup.TopMargin = sourcea.PageSetup.TopMargin

    target.PageSetup.BottomMargin = sourcea.PageSetup.BottomMargin

    target.AcceptAllRevisions

    Counter = 0

    While Counter < Pages

    sourcea.Activate

    ActiveDocument.Bookmarks("\page").Range.Copy

    Set targetrange = target.Range

    targetrange.Start = targetrange.End

    targetrange.Paste

    ActiveDocument.Bookmarks("\page").Range.Cut

    sourceb.Activate 'Assumed to be the document containing the even pages

    Selection.EndKey Unit:=wdStory 'Line of code added to start from the end of the document

    ActiveDocument.Bookmarks("\page").Range.Copy

    Set targetrange = target.Range

    targetrange.Start = targetrange.End

    targetrange.Paste

    targetrange.Start = targetrange.End

    targetrange.InsertBreak Type:=wdPageBreak

    Set evenpage = ActiveDocument.Bookmarks("\page").Range

    evenpage.Start = evenpage.Start - 1

    evenpage.Delete

    Counter = Counter + 1

    Wend

    sourcea.Close wdDoNotSaveChanges

    sourceb.Close wdDoNotSaveChanges

    0 comments No comments
  2. Anonymous
    2015-09-26T05:31:48+00:00

    Doug,

    Almost  What showed up is all the odd pages and the last page of the Even paged document every other page.

    Lets asy odd pages a re 1,3,5,7,9...,41 etc

    and even pages are 2,4,6,8....40.

    The final document had pages 1, 40,3,40,5,40,7,40  etc.

    Do you  assume both documents have the same number of pages?

    Odd paged document had more pages than the  even paged document for final notes etc.

    0 comments No comments
  3. Anonymous
    2015-09-26T13:49:23+00:00

    This really works well.  Thank YOU.

    Some slight editing on the finished document  formatting etc but this saves so much time over cut/paste.

    Thank you

    0 comments No comments