View Single Post
 
Old 11-14-2017, 10:47 AM
chrscote chrscote is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Aug 2016
Posts: 12
chrscote is on a distinguished road
Exclamation Copying and pasting pages with changes

I have a document which has Track Changes turned on. I want to select any pages that have a revision made to it and copy it to a 2nd document. I would also like to, if possible, include the footer contents of the page I'm copying. The first part is giving me problems, however. Here is the code I'm using:
Code:
For Each oRevision In oDoc.Revisions
        revNum = revNum + 1
        'If this page hasn't already been copied (for multiple revisions on single page)
        If oRevision.Range.Information(wdActiveEndPageNumber) <> nLastPageNum Then
            'Also check that the change is not in the header or footer
            If oRevision.Range.StoryType = wdMainTextStory Then
                MsgBox (oRevision.Range.Text)
                'Add 1 to counter
                n = n + 1
                oDoc.Activate
                ActiveDocument.Bookmarks("\Page").Select
                Selection.Copy
                oNewDoc.Activate
                Selection.EndKey wdStory
                Selection.InsertBreak (wdPageBreak)
                Selection.PasteAndFormat wdPasteDefault
                nLastPageNum = oRevision.Range.Information(wdActiveEndPageNumber)
            End If
        End If
    Next oRevision
Unfortunately, rather than select the page that contains the change in oDoc, the code selects the contents of the first page each time through the loop. I would appreciate any help I can get on this little dilemma. I'm sure that the 2nd half of my loop is OK, I just need to figure out the correct steps to be able to copy the appropriate page.

Chris
Reply With Quote